summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndy Savicki <lao.lav@gmail.com>2016-11-16 02:37:28 +0300
committerSergey M․ <dstftw@gmail.com>2016-11-21 22:16:26 +0700
commit4eece8ba572dfd009ea2d980bfc36d0adacb16d0 (patch)
treed780e53673eba8837c8b9532b0434a3de1a888e5
parent2574721a81cd52fa4fda65fb0a494064c09308c3 (diff)
downloadyoutube-dl-4eece8ba572dfd009ea2d980bfc36d0adacb16d0.tar.gz
youtube-dl-4eece8ba572dfd009ea2d980bfc36d0adacb16d0.tar.xz
youtube-dl-4eece8ba572dfd009ea2d980bfc36d0adacb16d0.zip
[funnyordie] Improve extraction
-rw-r--r--youtube_dl/extractor/funnyordie.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/youtube_dl/extractor/funnyordie.py b/youtube_dl/extractor/funnyordie.py
index 8c5ffc9e8..7664dd584 100644
--- a/youtube_dl/extractor/funnyordie.py
+++ b/youtube_dl/extractor/funnyordie.py
@@ -11,7 +11,7 @@ class FunnyOrDieIE(InfoExtractor):
     _VALID_URL = r'https?://(?:www\.)?funnyordie\.com/(?P<type>embed|articles|videos)/(?P<id>[0-9a-f]+)(?:$|[?#/])'
     _TESTS = [{
         'url': 'http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version',
-        'md5': 'bcd81e0c4f26189ee09be362ad6e6ba9',
+        'md5': 'c26b9ee0e1ca138c12071f59572ba9c7',
         'info_dict': {
             'id': '0732f586d7',
             'ext': 'mp4',
@@ -51,10 +51,7 @@ class FunnyOrDieIE(InfoExtractor):
 
         formats = []
 
-        formats.extend(self._extract_m3u8_formats(
-            m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
-
-        bitrates = [int(bitrate) for bitrate in re.findall(r'[,/]v(\d+)[,/]', m3u8_url)]
+        bitrates = [int(bitrate) for bitrate in re.findall(r'[,/]v(\d+)(?=[,/])', m3u8_url)]
         bitrates.sort()
 
         for bitrate in bitrates:
@@ -65,6 +62,11 @@ class FunnyOrDieIE(InfoExtractor):
                     'vbr': bitrate,
                 })
 
+        self._check_formats(formats, video_id)
+
+        formats.extend(self._extract_m3u8_formats(
+            m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
+
         subtitles = {}
         for src, src_lang in re.findall(r'<track kind="captions" src="([^"]+)" srclang="([^"]+)"', webpage):
             subtitles[src_lang] = [{