1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 09:12:40 +01:00

[facebook] Parse dash manifests

This commit is contained in:
pukkandan 2022-01-02 02:17:24 +05:30
parent a9f5f5d6eb
commit b8e976a445
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698

View File

@ -13,6 +13,7 @@
) )
from ..utils import ( from ..utils import (
clean_html, clean_html,
determine_ext,
error_to_compat_str, error_to_compat_str,
ExtractorError, ExtractorError,
float_or_none, float_or_none,
@ -510,15 +511,19 @@ def extract_relay_prefetched_data(_filter):
def parse_graphql_video(video): def parse_graphql_video(video):
formats = [] formats = []
q = qualities(['sd', 'hd']) q = qualities(['sd', 'hd'])
for (suffix, format_id) in [('', 'sd'), ('_quality_hd', 'hd')]: for key, format_id in (('playable_url', 'sd'), ('playable_url_quality_hd', 'hd'),
playable_url = video.get('playable_url' + suffix) ('playable_url_dash', '')):
playable_url = video.get(key)
if not playable_url: if not playable_url:
continue continue
formats.append({ if determine_ext(playable_url) == 'mpd':
'format_id': format_id, formats.extend(self._extract_mpd_formats(playable_url, video_id))
'quality': q(format_id), else:
'url': playable_url, formats.append({
}) 'format_id': format_id,
'quality': q(format_id),
'url': playable_url,
})
extract_dash_manifest(video, formats) extract_dash_manifest(video, formats)
process_formats(formats) process_formats(formats)
v_id = video.get('videoId') or video.get('id') or video_id v_id = video.get('videoId') or video.get('id') or video_id