mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-02-22 08:26:00 +00:00
[ie] Add browser impersonation support to more extractors (#16029)
Closes #7001, Closes #7444, Closes #16004 Authored by: bashonly
This commit is contained in:
@@ -25,7 +25,7 @@ class MixcloudBaseIE(InfoExtractor):
|
|||||||
%s
|
%s
|
||||||
}
|
}
|
||||||
}''' % (lookup_key, username, f', slug: "{slug}"' if slug else '', object_fields), # noqa: UP031
|
}''' % (lookup_key, username, f', slug: "{slug}"' if slug else '', object_fields), # noqa: UP031
|
||||||
})['data'][lookup_key]
|
}, impersonate=True)['data'][lookup_key]
|
||||||
|
|
||||||
|
|
||||||
class MixcloudIE(MixcloudBaseIE):
|
class MixcloudIE(MixcloudBaseIE):
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ class TruthIE(InfoExtractor):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
status = self._download_json(f'https://truthsocial.com/api/v1/statuses/{video_id}', video_id)
|
status = self._download_json(
|
||||||
|
f'https://truthsocial.com/api/v1/statuses/{video_id}', video_id, impersonate=True)
|
||||||
uploader_id = strip_or_none(traverse_obj(status, ('account', 'username')))
|
uploader_id = strip_or_none(traverse_obj(status, ('account', 'username')))
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ class XHamsterIE(InfoExtractor):
|
|||||||
display_id = mobj.group('display_id') or mobj.group('display_id_2')
|
display_id = mobj.group('display_id') or mobj.group('display_id_2')
|
||||||
|
|
||||||
desktop_url = re.sub(r'^(https?://(?:.+?\.)?)m\.', r'\1', url)
|
desktop_url = re.sub(r'^(https?://(?:.+?\.)?)m\.', r'\1', url)
|
||||||
webpage, urlh = self._download_webpage_handle(desktop_url, video_id)
|
webpage, urlh = self._download_webpage_handle(desktop_url, video_id, impersonate=True)
|
||||||
|
|
||||||
error = self._html_search_regex(
|
error = self._html_search_regex(
|
||||||
r'<div[^>]+id=["\']videoClosed["\'][^>]*>(.+?)</div>',
|
r'<div[^>]+id=["\']videoClosed["\'][^>]*>(.+?)</div>',
|
||||||
|
|||||||
Reference in New Issue
Block a user