mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-06-27 17:08:32 +00:00
[ie/sproutvideo] Fix extractor (#13544)
Closes #13540 Authored by: bashonly
This commit is contained in:
parent
8f94b76cbf
commit
5b559d0072
@ -41,6 +41,7 @@ class SproutVideoIE(InfoExtractor):
|
|||||||
'duration': 703,
|
'duration': 703,
|
||||||
'thumbnail': r're:https?://images\.sproutvideo\.com/.+\.jpg',
|
'thumbnail': r're:https?://images\.sproutvideo\.com/.+\.jpg',
|
||||||
},
|
},
|
||||||
|
'skip': 'Account Disabled',
|
||||||
}, {
|
}, {
|
||||||
# http formats 'sd' and 'hd' are available
|
# http formats 'sd' and 'hd' are available
|
||||||
'url': 'https://videos.sproutvideo.com/embed/119cd6bc1a18e6cd98/30751a1761ae5b90',
|
'url': 'https://videos.sproutvideo.com/embed/119cd6bc1a18e6cd98/30751a1761ae5b90',
|
||||||
@ -97,11 +98,21 @@ def _extract_embed_urls(cls, url, webpage):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
url, smuggled_data = unsmuggle_url(url, {})
|
url, smuggled_data = unsmuggle_url(url, {})
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(url, video_id, headers={
|
||||||
url, video_id, headers=traverse_obj(smuggled_data, {'Referer': 'referer'}))
|
**traverse_obj(smuggled_data, {'Referer': 'referer'}),
|
||||||
|
# yt-dlp's default Chrome user-agents are too old
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:140.0) Gecko/20100101 Firefox/140.0',
|
||||||
|
})
|
||||||
data = self._search_json(
|
data = self._search_json(
|
||||||
r'var\s+dat\s*=\s*["\']', webpage, 'data', video_id, contains_pattern=r'[A-Za-z0-9+/=]+',
|
r'var\s+(?:dat|playerInfo)\s*=\s*["\']', webpage, 'player info', video_id,
|
||||||
end_pattern=r'["\'];', transform_source=lambda x: base64.b64decode(x).decode())
|
contains_pattern=r'[A-Za-z0-9+/=]+', end_pattern=r'["\'];',
|
||||||
|
transform_source=lambda x: base64.b64decode(x).decode())
|
||||||
|
|
||||||
|
# SproutVideo may send player info for 'SMPTE Color Monitor Test' [a791d7b71b12ecc52e]
|
||||||
|
# e.g. if the user-agent we used with the webpage request is too old
|
||||||
|
video_uid = data['videoUid']
|
||||||
|
if video_id != video_uid:
|
||||||
|
raise ExtractorError(f'{self.IE_NAME} sent the wrong video data ({video_uid})')
|
||||||
|
|
||||||
formats, subtitles = [], {}
|
formats, subtitles = [], {}
|
||||||
headers = {
|
headers = {
|
||||||
|
Loading…
Reference in New Issue
Block a user