0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-12-02 03:47:27 +00:00

[extractor/generic] Fix JSON LD manifest extraction (#5577)

Closes #5572
Authored by: bashonly, pukkandan
This commit is contained in:
bashonly 2022-11-18 02:04:03 +00:00 committed by GitHub
parent 352e7d9873
commit ed027fd9d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,6 +10,7 @@
from ..compat import compat_etree_fromstring from ..compat import compat_etree_fromstring
from ..utils import ( from ..utils import (
KNOWN_EXTENSIONS, KNOWN_EXTENSIONS,
MEDIA_EXTENSIONS,
ExtractorError, ExtractorError,
UnsupportedError, UnsupportedError,
determine_ext, determine_ext,
@ -2572,8 +2573,9 @@ def _extract_embeds(self, url, webpage, *, urlh=None, info_dict={}):
json_ld = self._search_json_ld(webpage, video_id, default={}) json_ld = self._search_json_ld(webpage, video_id, default={})
if json_ld.get('url') not in (url, None): if json_ld.get('url') not in (url, None):
self.report_detected('JSON LD') self.report_detected('JSON LD')
is_direct = json_ld.get('ext') not in (None, *MEDIA_EXTENSIONS.manifests)
return [merge_dicts({ return [merge_dicts({
'_type': 'video' if json_ld.get('ext') else 'url_transparent', '_type': 'video' if is_direct else 'url_transparent',
'url': smuggle_url(json_ld['url'], { 'url': smuggle_url(json_ld['url'], {
'force_videoid': video_id, 'force_videoid': video_id,
'to_generic': True, 'to_generic': True,