diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-07-21 23:54:31 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-07-21 23:54:31 +0600 |
commit | 496ce6b3493757e806d857363955a2289410a4e5 (patch) | |
tree | 5b2b3f8c2daa1954a3b9ffe21069fb67af1c6ed3 /youtube_dl | |
parent | ce9512b78bbd5f180f44670f6b78784a0be3b815 (diff) |
[snagfilms] Improve m3u8 extraction (Closes #6309)
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/snagfilms.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/youtube_dl/extractor/snagfilms.py b/youtube_dl/extractor/snagfilms.py index cf495f310..0e820d250 100644 --- a/youtube_dl/extractor/snagfilms.py +++ b/youtube_dl/extractor/snagfilms.py @@ -24,6 +24,15 @@ class SnagFilmsEmbedIE(InfoExtractor): 'title': '#whilewewatch', } }, { + # invalid labels, 360p is better that 480p + 'url': 'http://www.snagfilms.com/embed/player?filmId=17ca0950-a74a-11e0-a92a-0026bb61d036', + 'md5': '882fca19b9eb27ef865efeeaed376a48', + 'info_dict': { + 'id': '17ca0950-a74a-11e0-a92a-0026bb61d036', + 'ext': 'mp4', + 'title': 'Life in Limbo', + } + }, { 'url': 'http://www.snagfilms.com/embed/player?filmId=0000014c-de2f-d5d6-abcf-ffef58af0017', 'only_matching': True, }] @@ -52,14 +61,15 @@ class SnagFilmsEmbedIE(InfoExtractor): if not file_: continue type_ = source.get('type') - format_id = source.get('label') ext = determine_ext(file_) - if any(_ == 'm3u8' for _ in (type_, ext)): + format_id = source.get('label') or ext + if all(_ == 'm3u8' for _ in (type_, ext)): formats.extend(self._extract_m3u8_formats( file_, video_id, 'mp4', m3u8_id='hls')) else: bitrate = int_or_none(self._search_regex( - r'(\d+)kbps', file_, 'bitrate', default=None)) + [r'(\d+)kbps', r'_\d{1,2}x\d{1,2}_(\d{3,})\.%s' % ext], + file_, 'bitrate', default=None)) height = int_or_none(self._search_regex( r'^(\d+)[pP]$', format_id, 'height', default=None)) formats.append({ |