aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/watch.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2020-06-28 17:52:24 -0700
committerJames Taylor <user234683@users.noreply.github.com>2020-06-28 17:52:24 -0700
commitaa3e5aa441b79a471f96080501c114fd9ad34ba5 (patch)
treea4cb033365f495b3d328c6b41e0273d2399f3b57 /youtube/watch.py
parent6e14a8547d05cf02ad72e8415f70072bdf599212 (diff)
downloadyt-local-aa3e5aa441b79a471f96080501c114fd9ad34ba5.tar.lz
yt-local-aa3e5aa441b79a471f96080501c114fd9ad34ba5.tar.xz
yt-local-aa3e5aa441b79a471f96080501c114fd9ad34ba5.zip
Add dialog for copying urls to external player for livestreams
Also for livestreams which are over whose other sources aren't present or aren't ready yet.
Diffstat (limited to 'youtube/watch.py')
-rw-r--r--youtube/watch.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/youtube/watch.py b/youtube/watch.py
index 929a1ac..b5636b8 100644
--- a/youtube/watch.py
+++ b/youtube/watch.py
@@ -242,6 +242,22 @@ def extract_info(video_id, use_invidious, playlist_id=None, index=None):
decryption_error = 'Error decrypting url signatures: ' + decryption_error
info['playability_error'] = decryption_error
+ # livestream urls
+ # sometimes only the livestream urls work soon after the livestream is over
+ if info['hls_manifest_url'] and (info['live'] or not info['formats']):
+ manifest = util.fetch_url(info['hls_manifest_url'],
+ debug_name='hls_manifest.m3u8',
+ report_text='Fetched hls manifest'
+ ).decode('utf-8')
+
+ info['hls_formats'], err = yt_data_extract.extract_hls_formats(manifest)
+ if not err:
+ info['playability_error'] = None
+ for fmt in info['hls_formats']:
+ fmt['video_quality'] = video_quality_string(fmt)
+ else:
+ info['hls_formats'] = []
+
# check for 403
info['invidious_used'] = False
info['invidious_reload_button'] = False
@@ -396,7 +412,7 @@ def get_watch_page(video_id=None):
download_formats = []
- for format in info['formats']:
+ for format in (info['formats'] + info['hls_formats']):
if format['acodec'] and format['vcodec']:
codecs_string = format['acodec'] + ', ' + format['vcodec']
else:
@@ -435,6 +451,7 @@ def get_watch_page(video_id=None):
download_formats = download_formats,
video_info = json.dumps(video_info),
video_sources = video_sources,
+ hls_formats = info['hls_formats'],
subtitle_sources = get_subtitle_sources(info),
related = info['related_videos'],
playlist = info['playlist'],