diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-06-28 18:18:04 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2020-06-28 18:18:04 -0700 |
commit | 803c901445bc2bbfce2e7bf970237ccf6cc00ea7 (patch) | |
tree | e29802703cbbcf7ae2d84484b67da00bb92c9d68 /youtube/yt_data_extract | |
parent | aa3e5aa441b79a471f96080501c114fd9ad34ba5 (diff) | |
download | yt-local-803c901445bc2bbfce2e7bf970237ccf6cc00ea7.tar.lz yt-local-803c901445bc2bbfce2e7bf970237ccf6cc00ea7.tar.xz yt-local-803c901445bc2bbfce2e7bf970237ccf6cc00ea7.zip |
Fix hls_manifest_url not included when there's no other formats
Since there are no formats, it was retrying with the
non-embedded playerResponse, which resulted in the
hls_manifest_urls from the embedded player_response being
overwritten with None. So use conservative_update instead
Diffstat (limited to 'youtube/yt_data_extract')
-rw-r--r-- | youtube/yt_data_extract/watch_extraction.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/youtube/yt_data_extract/watch_extraction.py b/youtube/yt_data_extract/watch_extraction.py index 5aaa318..ca2da10 100644 --- a/youtube/yt_data_extract/watch_extraction.py +++ b/youtube/yt_data_extract/watch_extraction.py @@ -340,8 +340,12 @@ def _extract_formats(info, player_response): yt_formats = streaming_data.get('formats', []) + streaming_data.get('adaptiveFormats', []) info['formats'] = [] - info['hls_manifest_url'] = streaming_data.get('hlsManifestUrl') - info['dash_manifest_url'] = streaming_data.get('dashManifestUrl') + # because we may retry the extract_formats with a different player_response + # so keep what we have + conservative_update(info, 'hls_manifest_url', + streaming_data.get('hlsManifestUrl')) + conservative_update(info, 'dash_manifest_url', + streaming_data.get('dash_manifest_url')) for yt_fmt in yt_formats: fmt = {} |