From cdfd4ff16ef45a00c448983586b4fcc7cd8ef123 Mon Sep 17 00:00:00 2001 From: Hitesh Kumar Saini Date: Wed, 29 Jul 2020 10:05:02 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8C=20v1.2.7=20Fixed=20empty=20respons?= =?UTF-8?q?e=20from=20SearchVideos=20(#16)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- youtubesearchpython/videos__scripthandler.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/youtubesearchpython/videos__scripthandler.py b/youtubesearchpython/videos__scripthandler.py index fbd1ffe..981953a 100644 --- a/youtubesearchpython/videos__scripthandler.py +++ b/youtubesearchpython/videos__scripthandler.py @@ -42,17 +42,15 @@ def scriptResponseHandler(self): #########Setting Video Links, IDs And Thumbnails.######### - if self.pageSource[index][-98:] == '"commandMetadata":{"webCommandMetadata":{}},"addToPlaylistCommand":{"openMiniplayer":true,"videoId': - temp+=1 - if temp % 2 == 0: - id = self.pageSource[index+1][0:11] - thumbnailbuffer = [] - modes = ["default", "hqdefault", "mqdefault", "sddefault", "maxresdefault"] - self.ids+=[id] - self.links+=['https://www.youtube.com/watch?v='+ id] - for mode in modes: - thumbnailbuffer+=["https://img.youtube.com/vi/" + id + "/" + mode + ".jpg"] - self.thumbnails+=[thumbnailbuffer] + if self.pageSource[index][0:9] == '/watch?v=': + id = self.pageSource[index][9:20] + modes = ["default", "hqdefault", "mqdefault", "sddefault", "maxresdefault"] + self.ids+=[id] + self.links+=['https://www.youtube.com/watch?v='+ id] + thumbnailbuffer = [] + for mode in modes: + thumbnailbuffer+=["https://img.youtube.com/vi/" + id + "/" + mode + ".jpg"] + self.thumbnails+=[thumbnailbuffer] #########Setting Video Titles.#########