Skip to content

Commit

Permalink
handle missing storyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
zrose584 committed Jan 16, 2022
1 parent 12da3e8 commit 34d554e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion youtube/static/js/plyr-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const player = new Plyr(document.querySelector('video'), {
},
},
previewThumbnails: {
enabled: true,
enabled: storyboard_url != null,
src: [storyboard_url],
},
settings: ['captions', 'quality', 'speed', 'loop'],
Expand Down
3 changes: 2 additions & 1 deletion youtube/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,8 @@ def get_watch_page(video_id=None):
video_url = util.URL_ORIGIN + '/watch?v=' + video_id,
video_id = video_id,
storyboard_url = (util.URL_ORIGIN + '/ytl-api/storyboard.vtt?' +
urlencode([('spec_url', info['storyboard_spec_url'])])),
urlencode([('spec_url', info['storyboard_spec_url'])])
if info['storyboard_spec_url'] else None),

js_data = {
'video_id': info['id'],
Expand Down
3 changes: 2 additions & 1 deletion youtube/yt_data_extract/watch_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,8 @@ def extract_watch_info(polymer_json):

# other stuff
info['author_url'] = 'https://www.youtube.com/channel/' + info['author_id'] if info['author_id'] else None
info['storyboard_spec_url'] = player_response['storyboards']['playerStoryboardSpecRenderer']['spec']
sb = player_response.get('storyboards')
info['storyboard_spec_url'] = sb['playerStoryboardSpecRenderer']['spec'] if sb else None

return info

Expand Down

0 comments on commit 34d554e

Please sign in to comment.