@@ -17,6 +17,7 @@ func fetchDescriptionsInBackground(
17
17
videoData []SearchResultItem ,
18
18
descriptionCache map [string ]string ,
19
19
cacheLock * sync.RWMutex ,
20
+ proxyURLString string ,
20
21
) {
21
22
go func () {
22
23
for {
@@ -40,7 +41,7 @@ func fetchDescriptionsInBackground(
40
41
}
41
42
42
43
// Fetch the video description with retries
43
- if err := fetchAndCacheDescription (video , descriptionCache , cacheLock ); err != nil {
44
+ if err := fetchAndCacheDescription (video , descriptionCache , cacheLock , proxyURLString ); err != nil {
44
45
utils .Logger .Error ("Failed to fetch description." , zap .Error (err ))
45
46
continue
46
47
}
@@ -73,9 +74,14 @@ func cleanDescription(description string) string {
73
74
}
74
75
75
76
// Fetches a single video description and stores it in cache.
76
- func fetchAndCacheDescription (video SearchResultItem , descriptionCache map [string ]string , cacheLock * sync.RWMutex ) error {
77
+ func fetchAndCacheDescription (
78
+ video SearchResultItem ,
79
+ descriptionCache map [string ]string ,
80
+ cacheLock * sync.RWMutex ,
81
+ proxyURLString string ,
82
+ ) error {
77
83
for {
78
- videoInfo , err := SearchVideoInfo (video .VideoID )
84
+ videoInfo , err := SearchVideoInfo (video .VideoID , proxyURLString )
79
85
if err != nil {
80
86
utils .Logger .Info ("Fetching description failed. Retrying..." , zap .String ("videoTitle" , video .Title ), zap .Error (err ))
81
87
}
@@ -139,13 +145,13 @@ func getVideoPreview(video SearchResultItem, descriptionCache map[string]string,
139
145
}
140
146
141
147
// Handles the interactive menu for video selection. Powered by fzf-like
142
- func YoutubeResultMenu (videoData []SearchResultItem ) (SearchResultItem , error ) {
148
+ func YoutubeResultMenu (videoData []SearchResultItem , proxyURLString string ) (SearchResultItem , error ) {
143
149
// Cache to store video descriptions
144
150
descriptionCache := make (map [string ]string )
145
151
cacheLock := sync.RWMutex {} // For thread-safe cache access
146
152
147
153
// Start background fetching of descriptions
148
- fetchDescriptionsInBackground (videoData , descriptionCache , & cacheLock )
154
+ fetchDescriptionsInBackground (videoData , descriptionCache , & cacheLock , proxyURLString )
149
155
150
156
utils .Logger .Info ("Opening search menu." )
151
157
idx , err := fuzzyfinder .Find (
0 commit comments