Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit cdfd4ff

Browse files
committed
👌 v1.2.7 Fixed empty response from SearchVideos (#16)
1 parent e3df8ba commit cdfd4ff

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

youtubesearchpython/videos__scripthandler.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,15 @@ def scriptResponseHandler(self):
4242

4343
#########Setting Video Links, IDs And Thumbnails.#########
4444

45-
if self.pageSource[index][-98:] == '"commandMetadata":{"webCommandMetadata":{}},"addToPlaylistCommand":{"openMiniplayer":true,"videoId':
46-
temp+=1
47-
if temp % 2 == 0:
48-
id = self.pageSource[index+1][0:11]
49-
thumbnailbuffer = []
50-
modes = ["default", "hqdefault", "mqdefault", "sddefault", "maxresdefault"]
51-
self.ids+=[id]
52-
self.links+=['https://www.youtube.com/watch?v='+ id]
53-
for mode in modes:
54-
thumbnailbuffer+=["https://img.youtube.com/vi/" + id + "/" + mode + ".jpg"]
55-
self.thumbnails+=[thumbnailbuffer]
45+
if self.pageSource[index][0:9] == '/watch?v=':
46+
id = self.pageSource[index][9:20]
47+
modes = ["default", "hqdefault", "mqdefault", "sddefault", "maxresdefault"]
48+
self.ids+=[id]
49+
self.links+=['https://www.youtube.com/watch?v='+ id]
50+
thumbnailbuffer = []
51+
for mode in modes:
52+
thumbnailbuffer+=["https://img.youtube.com/vi/" + id + "/" + mode + ".jpg"]
53+
self.thumbnails+=[thumbnailbuffer]
5654

5755
#########Setting Video Titles.#########
5856

0 commit comments

Comments
 (0)