diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2015-04-21 13:48:02 +0800 |
---|---|---|
committer | Yen Chi Hsuan <yan12125@gmail.com> | 2015-04-21 13:48:02 +0800 |
commit | 0954cd8aa4421b1844a30e99702c364f1fffc15f (patch) | |
tree | bc06dd2ac3bac151782a63718234bfc661b06d0d | |
parent | da55dac047d63d48fd12247369b2fb858c4210ef (diff) |
[Cinemassacre] Add detection for videos from blip.tv
-rw-r--r-- | youtube_dl/extractor/bliptv.py | 9 | ||||
-rw-r--r-- | youtube_dl/extractor/generic.py | 10 | ||||
-rw-r--r-- | youtube_dl/extractor/screenwavemedia.py | 23 |
3 files changed, 35 insertions, 7 deletions
diff --git a/youtube_dl/extractor/bliptv.py b/youtube_dl/extractor/bliptv.py index b632ce967..fb56cd78d 100644 --- a/youtube_dl/extractor/bliptv.py +++ b/youtube_dl/extractor/bliptv.py @@ -102,6 +102,15 @@ class BlipTVIE(InfoExtractor): }, ] + @staticmethod + def _extract_url(webpage): + mobj = re.search(r'<meta\s[^>]*https?://api\.blip\.tv/\w+/redirect/\w+/(\d+)', webpage) + if mobj: + return 'http://blip.tv/a/a-' + mobj.group(1) + mobj = re.search(r'<(?:iframe|embed|object)\s[^>]*(https?://(?:\w+\.)?blip\.tv/(?:play/|api\.swf#)[a-zA-Z0-9_]+)', webpage) + if mobj: + return mobj.group(1) + def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) lookup_id = mobj.group('lookup_id') diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py index ec4d0c210..4946cc132 100644 --- a/youtube_dl/extractor/generic.py +++ b/youtube_dl/extractor/generic.py @@ -36,6 +36,7 @@ from .smotri import SmotriIE from .condenast import CondeNastIE from .udn import UDNEmbedIE from .senateisvp import SenateISVPIE +from .bliptv import BlipTVIE class GenericIE(InfoExtractor): @@ -1073,12 +1074,9 @@ class GenericIE(InfoExtractor): } # Look for embedded blip.tv player - mobj = re.search(r'<meta\s[^>]*https?://api\.blip\.tv/\w+/redirect/\w+/(\d+)', webpage) - if mobj: - return self.url_result('http://blip.tv/a/a-' + mobj.group(1), 'BlipTV') - mobj = re.search(r'<(?:iframe|embed|object)\s[^>]*(https?://(?:\w+\.)?blip\.tv/(?:play/|api\.swf#)[a-zA-Z0-9_]+)', webpage) - if mobj: - return self.url_result(mobj.group(1), 'BlipTV') + bliptv_url = BlipTVIE._extract_url(webpage) + if bliptv_url: + return self.url_result(bliptv_url, 'BlipTV') # Look for embedded condenast player matches = re.findall( diff --git a/youtube_dl/extractor/screenwavemedia.py b/youtube_dl/extractor/screenwavemedia.py index 6c9fdb7c1..b515b11b4 100644 --- a/youtube_dl/extractor/screenwavemedia.py +++ b/youtube_dl/extractor/screenwavemedia.py @@ -7,7 +7,9 @@ from .common import InfoExtractor from ..utils import ( int_or_none, unified_strdate, + ExtractorError ) +from .bliptv import BlipTVIE class ScreenwaveMediaIE(InfoExtractor): @@ -104,6 +106,20 @@ class CinemassacreIE(InfoExtractor): 'upload_date': '20131002', 'title': 'The Mummy’s Hand (1940)', }, + }, + { + 'url': 'http://cinemassacre.com/2006/12/07/chronologically-confused-about-bad-movie-and-video-game-sequel-titles/', + 'md5': 'ca9b3c8dd5a66f9375daeb5135f5a3de', + 'info_dict': { + 'id': '4065369', + 'ext': 'flv', + 'title': 'AVGN: Chronologically Confused about Bad Movie and Video Game Sequel Titles', + 'upload_date': '20061207', + 'uploader': 'cinemassacre', + 'uploader_id': '250778', + 'timestamp': 1283233867, + 'description': 'md5:0a108c78d130676b207d0f6d029ecffd', + } } ] @@ -116,7 +132,12 @@ class CinemassacreIE(InfoExtractor): playerdata_url = self._search_regex( r'src="(http://player\.screenwavemedia\.com/play/[a-zA-Z]+\.php\?[^"]*\bid=.+?)"', - webpage, 'player data URL') + webpage, 'player data URL', default=None) + if not playerdata_url: + playerdata_url = BlipTVIE._extract_url(webpage) + if not playerdata_url: + raise ExtractorError('Unable to find player data') + video_title = self._html_search_regex( r'<title>(?P<title>.+?)\|', webpage, 'title') video_description = self._html_search_regex( |