aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-07-15 18:36:26 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-07-15 18:36:26 -0700
commita0c2bde43564ea753a6f61cfc00a190a5ea3ac15 (patch)
tree0f63d97ccf0fae9ab1db95f25231188858f8a6a0
parent07b92c35a20a167199fb1adb4908f2501f84357f (diff)
downloadyt-local-a0c2bde43564ea753a6f61cfc00a190a5ea3ac15.tar.lz
yt-local-a0c2bde43564ea753a6f61cfc00a190a5ea3ac15.tar.xz
yt-local-a0c2bde43564ea753a6f61cfc00a190a5ea3ac15.zip
fix error with limited state videos
-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),