aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/chaturbate.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-04-09 01:39:40 +0700
committerSergey M․ <dstftw@gmail.com>2017-04-09 01:39:40 +0700
commita6f7263cf421d9156048596cca0552e027e70788 (patch)
treefc9f5c9fd850ccbe3406ae4892f01680ccf9952b /youtube_dl/extractor/chaturbate.py
parent43724365048755adbea8bbff05708903ea52e1a8 (diff)
[chaturbate] Fix extraction (closes #12665)
Diffstat (limited to 'youtube_dl/extractor/chaturbate.py')
-rw-r--r--youtube_dl/extractor/chaturbate.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/youtube_dl/extractor/chaturbate.py b/youtube_dl/extractor/chaturbate.py
index 8fbc91c1f..e3eba4be9 100644
--- a/youtube_dl/extractor/chaturbate.py
+++ b/youtube_dl/extractor/chaturbate.py
@@ -33,10 +33,17 @@ class ChaturbateIE(InfoExtractor):
webpage = self._download_webpage(url, video_id)
- m3u8_formats = [(m.group('id').lower(), m.group('url')) for m in re.finditer(
- r'hlsSource(?P<id>.+?)\s*=\s*(?P<q>["\'])(?P<url>http.+?)(?P=q)', webpage)]
+ m3u8_urls = []
- 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(
[r'<span[^>]+class=(["\'])desc_span\1[^>]*>(?P<error>[^<]+)</span>',
r'<div[^>]+id=(["\'])defchat\1[^>]*>\s*<p><strong>(?P<error>[^<]+)<'],
@@ -50,7 +57,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