mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-04 23:35:04 +00:00
[extractor/twitcasting] Fix data-movie-playlist
extraction (#5453)
Authored by: Lesmiscore
This commit is contained in:
parent
0d113603ac
commit
da9a60ca0d
1 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import base64
|
||||||
import itertools
|
import itertools
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -74,6 +75,16 @@ class TwitCastingIE(InfoExtractor):
|
||||||
'playlist_mincount': 2,
|
'playlist_mincount': 2,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def _parse_data_movie_playlist(self, dmp, video_id):
|
||||||
|
# attempt 1: parse as JSON directly
|
||||||
|
try:
|
||||||
|
return self._parse_json(dmp, video_id)
|
||||||
|
except ExtractorError:
|
||||||
|
pass
|
||||||
|
# attempt 2: decode reversed base64
|
||||||
|
decoded = base64.b64decode(dmp[::-1])
|
||||||
|
return self._parse_json(decoded, video_id)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
uploader_id, video_id = self._match_valid_url(url).groups()
|
uploader_id, video_id = self._match_valid_url(url).groups()
|
||||||
|
|
||||||
|
@ -100,7 +111,7 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
video_js_data = try_get(
|
video_js_data = try_get(
|
||||||
webpage,
|
webpage,
|
||||||
lambda x: self._parse_json(self._search_regex(
|
lambda x: self._parse_data_movie_playlist(self._search_regex(
|
||||||
r'data-movie-playlist=\'([^\']+?)\'',
|
r'data-movie-playlist=\'([^\']+?)\'',
|
||||||
x, 'movie playlist', default=None), video_id)['2'], list)
|
x, 'movie playlist', default=None), video_id)['2'], list)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue