aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
Diffstat (limited to 'youtube')
-rw-r--r--youtube/watch.py6
1 files 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),