diff options
author | Jesús <heckyel@hyperbola.info> | 2022-05-30 22:45:08 +0800 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2022-05-30 22:45:08 +0800 |
commit | 1fbc0cdd466eff4b79d2fe1959b407b791f040ae (patch) | |
tree | c27aaf38763d83b34c2c35967238df6d4d7d3d2e /youtube/watch.py | |
parent | 263469cd30ce91b3ba2eb49a0ed5be281571e7c7 (diff) | |
download | yt-local-1fbc0cdd466eff4b79d2fe1959b407b791f040ae.tar.lz yt-local-1fbc0cdd466eff4b79d2fe1959b407b791f040ae.tar.xz yt-local-1fbc0cdd466eff4b79d2fe1959b407b791f040ae.zip |
Fix preview_thumbnails
use 'deep_get' for storyboard
Diffstat (limited to 'youtube/watch.py')
-rw-r--r-- | youtube/watch.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/youtube/watch.py b/youtube/watch.py index 3533f30..97151e8 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -521,19 +521,19 @@ def get_storyboard_vtt(): """ spec_url = request.args.get('spec_url') - url, *l = spec_url.split('|') - url1, q = url.split('?') - q = parse_qs(q) + url, *boards = spec_url.split('|') + base_url, q = url.split('?') + q = parse_qs(q) # for url query storyboard = None wanted_height = 90 - for i, board in enumerate(l): + for i, board in enumerate(boards): *t, _, sigh = board.split("#") width, height, count, width_cnt, height_cnt, interval = map(int, t) if height != wanted_height: continue q['sigh'] = [sigh] - url = f"{url1}?{urlencode(q, doseq=True)}" + url = f"{base_url}?{urlencode(q, doseq=True)}" storyboard = SimpleNamespace( url = url.replace("$L", str(i)).replace("$N", "M$M"), width = width, @@ -553,8 +553,8 @@ def get_storyboard_vtt(): m, s = divmod(s, 60) return f"{h:02}:{m:02}:{s:02}.{ms:03}" - r = "WEBVTT" - ts = 0 + r = "WEBVTT" # result + ts = 0 # current timestamp for i in range(storyboard.storyboard_count): url = '/' + storyboard.url.replace("$M", str(i)) |