From ed688ac2ff7187e2f6f851c528cbbc11e3fbaa8c Mon Sep 17 00:00:00 2001 From: pluja Date: Mon, 5 Oct 2020 13:23:52 +0200 Subject: [PATCH] Fix bug, some videos not working --- youtube_data/videos.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/youtube_data/videos.py b/youtube_data/videos.py index 286ca4a..3788274 100644 --- a/youtube_data/videos.py +++ b/youtube_data/videos.py @@ -204,11 +204,15 @@ def get_video_owner_info(data): item = get_renderer_key(contents, "videoSecondaryInfoRenderer") ownerItem = item['owner']['videoOwnerRenderer'] + try: + sC = ownerItem['subscriberCountText']['runs'][0]['text'] + except: + sC = "Unknown" ownerInfo = { "thumbnail": ownerItem['thumbnail']['thumbnails'][0]['url'], "username": ownerItem['title']['runs'][0]['text'], "id": ownerItem['title']['runs'][0]['navigationEndpoint']['browseEndpoint']['browseId'], - "suscriberCount":ownerItem['subscriberCountText']['runs'][0]['text'] + "suscriberCount":sC } return ownerInfo