From a0c2bde43564ea753a6f61cfc00a190a5ea3ac15 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sun, 15 Jul 2018 18:36:26 -0700 Subject: fix error with limited state videos --- youtube/watch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/youtube/watch.py b/youtube/watch.py index c64efbc..5bf6ebb 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -326,9 +326,9 @@ def get_watch_page(query_string): uploader = html.escape(info["uploader"]), uploader_channel_url = '/' + info["uploader_url"], upload_date = upload_date, - views = '{:,}'.format(info["view_count"]), - likes = (lambda x: '{:,}'.format(x) if x is not None else "")(info["like_count"]), - dislikes = (lambda x: '{:,}'.format(x) if x is not None else "")(info["dislike_count"]), + views = (lambda x: '{:,}'.format(x) if x is not None else "")(info.get("view_count", None)), + likes = (lambda x: '{:,}'.format(x) if x is not None else "")(info.get("like_count", None)), + dislikes = (lambda x: '{:,}'.format(x) if x is not None else "")(info.get("dislike_count", None)), video_info = html.escape(json.dumps(video_info)), description = html.escape(info["description"]), video_sources = formats_html(info) + subtitles_html(info), -- cgit v1.2.3