X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/b8d8e13c1f9e4d3cdd7d41c5c9d711a36dd5f9c3..a8e7aba9859e62297ac6d938a37ba982d4fe5eb8:/youtube_dl/extractor/chaturbate.py diff --git a/youtube_dl/extractor/chaturbate.py b/youtube_dl/extractor/chaturbate.py index 8fbc91c..e2b828d 100644 --- a/youtube_dl/extractor/chaturbate.py +++ b/youtube_dl/extractor/chaturbate.py @@ -31,12 +31,20 @@ class ChaturbateIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id) + webpage = self._download_webpage( + url, video_id, headers=self.geo_verification_headers()) - m3u8_formats = [(m.group('id').lower(), m.group('url')) for m in re.finditer( - r'hlsSource(?P.+?)\s*=\s*(?P["\'])(?Phttp.+?)(?P=q)', webpage)] + m3u8_urls = [] - if not m3u8_formats: + for m in re.finditer( + r'(["\'])(?Phttp.+?\.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( [r']+class=(["\'])desc_span\1[^>]*>(?P[^<]+)', r']+id=(["\'])defchat\1[^>]*>\s*

(?P[^<]+)<'], @@ -50,7 +58,8 @@ class ChaturbateIE(InfoExtractor): raise ExtractorError('Unable to find stream URL') 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( m3u8_url, video_id, ext='mp4', # ffmpeg skips segments for fast m3u8