mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-29 13:42:37 +00:00
[chaturbate] Fix extraction (closes #12665)
This commit is contained in:
parent
4372436504
commit
a6f7263cf4
1 changed files with 12 additions and 4 deletions
|
@ -33,10 +33,17 @@ class ChaturbateIE(InfoExtractor):
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
m3u8_formats = [(m.group('id').lower(), m.group('url')) for m in re.finditer(
|
m3u8_urls = []
|
||||||
r'hlsSource(?P<id>.+?)\s*=\s*(?P<q>["\'])(?P<url>http.+?)(?P=q)', webpage)]
|
|
||||||
|
|
||||||
if not m3u8_formats:
|
for m in re.finditer(
|
||||||
|
r'(["\'])(?P<url>http.+?\.m3u8.*?)\1', webpage):
|
||||||
|
m3u8_fast_url, m3u8_no_fast_url = m.group('url'), m.group(
|
||||||
|
'url').replace('_fast', '')
|
||||||
|
for m3u8_url in (m3u8_fast_url, m3u8_no_fast_url):
|
||||||
|
if m3u8_url not in m3u8_urls:
|
||||||
|
m3u8_urls.append(m3u8_url)
|
||||||
|
|
||||||
|
if not m3u8_urls:
|
||||||
error = self._search_regex(
|
error = self._search_regex(
|
||||||
[r'<span[^>]+class=(["\'])desc_span\1[^>]*>(?P<error>[^<]+)</span>',
|
[r'<span[^>]+class=(["\'])desc_span\1[^>]*>(?P<error>[^<]+)</span>',
|
||||||
r'<div[^>]+id=(["\'])defchat\1[^>]*>\s*<p><strong>(?P<error>[^<]+)<'],
|
r'<div[^>]+id=(["\'])defchat\1[^>]*>\s*<p><strong>(?P<error>[^<]+)<'],
|
||||||
|
@ -50,7 +57,8 @@ class ChaturbateIE(InfoExtractor):
|
||||||
raise ExtractorError('Unable to find stream URL')
|
raise ExtractorError('Unable to find stream URL')
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for m3u8_id, m3u8_url in m3u8_formats:
|
for m3u8_url in m3u8_urls:
|
||||||
|
m3u8_id = 'fast' if '_fast' in m3u8_url else 'slow'
|
||||||
formats.extend(self._extract_m3u8_formats(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
m3u8_url, video_id, ext='mp4',
|
m3u8_url, video_id, ext='mp4',
|
||||||
# ffmpeg skips segments for fast m3u8
|
# ffmpeg skips segments for fast m3u8
|
||||||
|
|
Loading…
Reference in a new issue