diff options
author | James Taylor <user234683@users.noreply.github.com> | 2018-07-06 18:12:41 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2018-07-06 18:16:15 -0700 |
commit | 1eecc5a880a460ebe18d513a94010b265303d567 (patch) | |
tree | 6cdd3909199a3c5ead6d4438f82c5eef5fc0fa13 /youtube/common.py | |
parent | 2cf83d6e2a083969aff8ededfcad555ca9bf8e71 (diff) | |
download | yt-local-1eecc5a880a460ebe18d513a94010b265303d567.tar.lz yt-local-1eecc5a880a460ebe18d513a94010b265303d567.tar.xz yt-local-1eecc5a880a460ebe18d513a94010b265303d567.zip |
fix video length not being gotten for grid renderers
Diffstat (limited to 'youtube/common.py')
-rw-r--r-- | youtube/common.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/youtube/common.py b/youtube/common.py index 6994064..d9429a2 100644 --- a/youtube/common.py +++ b/youtube/common.py @@ -360,7 +360,18 @@ def renderer_info(renderer): info['views'] = get_text(renderer['viewCountText']) elif 'shortViewCountText' in renderer: info['views'] = get_text(renderer['shortViewCountText']) - + try: + overlays = renderer['thumbnailOverlays'] + except KeyError: + pass + else: + for overlay in overlays: + try: + info['duration'] = get_text(overlay['thumbnailOverlayTimeStatusRenderer']['text']) + except KeyError: + pass + else: + break for key, node in renderer.items(): if key in ('longBylineText', 'shortBylineText'): info['author'] = get_text(node) |