diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-06-28 18:20:47 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2020-06-28 18:20:47 -0700 |
commit | 44d7f9da994ca311c6125664d9fcfe91f4971d72 (patch) | |
tree | 728c0f2b19eeaabfccbd5e3194f451bff1109335 | |
parent | 803c901445bc2bbfce2e7bf970237ccf6cc00ea7 (diff) | |
download | yt-local-44d7f9da994ca311c6125664d9fcfe91f4971d72.tar.lz yt-local-44d7f9da994ca311c6125664d9fcfe91f4971d72.tar.xz yt-local-44d7f9da994ca311c6125664d9fcfe91f4971d72.zip |
Include livestream fmt urls for former livestream w/o static urls
If none of the format urls for the former livestream are static,
meaning they use a non-livestream format playable by the browser,
then include the dialog for copying hte livestream format urls
into external video player
-rw-r--r-- | youtube/watch.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/youtube/watch.py b/youtube/watch.py index b5636b8..a3d8e24 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -242,9 +242,21 @@ 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 + # check if urls ready (non-live format) in former livestream + # urls not ready if all of them have no filesize + if info['was_live']: + info['urls_ready'] = False + for fmt in info['formats']: + if fmt['file_size'] is not None: + info['urls_ready'] = True + else: + info['urls_ready'] = True + # 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']): + if (info['hls_manifest_url'] + and (info['live'] or not info['formats'] or not info['urls_ready']) + ): manifest = util.fetch_url(info['hls_manifest_url'], debug_name='hls_manifest.m3u8', report_text='Fetched hls manifest' |