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

Commit

Permalink
Make it a little bit more bulletproof
Browse files Browse the repository at this point in the history
  • Loading branch information
mytja committed May 1, 2022
1 parent f8af9d9 commit b94923d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions youtubesearchpython/core/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,19 @@ def parse_response(self):
response = self.data.json()

thumbnails = []
thumbnails.extend(getValue(response, ["header", "c4TabbedHeaderRenderer", "avatar", "thumbnails"]))
thumbnails.extend(getValue(response, ["metadata", "channelMetadataRenderer", "avatar", "thumbnails"]))
thumbnails.extend(getValue(response, ["microformat", "microformatDataRenderer", "thumbnail", "thumbnails"]))

try:
thumbnails.extend(getValue(response, ["header", "c4TabbedHeaderRenderer", "avatar", "thumbnails"]))
except:
pass
try:
thumbnails.extend(getValue(response, ["metadata", "channelMetadataRenderer", "avatar", "thumbnails"]))
except:
pass
try:
thumbnails.extend(getValue(response, ["microformat", "microformatDataRenderer", "thumbnail", "thumbnails"]))
except:
pass

tabData: dict = {}
playlists: list = []

Expand Down

0 comments on commit b94923d

Please sign in to comment.