From: Philipp Hagemeister Date: Wed, 26 Jun 2013 16:22:26 +0000 (+0200) Subject: [wimp] minor readability improvements (#940) X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=ed92bc9f6e402434e6d69d2947739d0c4151d77e;p=youtube-dl [wimp] minor readability improvements (#940) --- ed92bc9f6e402434e6d69d2947739d0c4151d77e diff --cc test/tests.json index aa540792e,816fabf70..ebc7a123c --- a/test/tests.json +++ b/test/tests.json @@@ -696,14 -696,13 +696,23 @@@ "title": "卡马乔国足开大脚长传冲吊集锦" } }, + { + "name": "CSpan", + "url": "http://www.c-spanvideo.org/program/HolderonV", + "file": "315139.flv", + "md5": "74a623266956f69e4df0068ab6c80fe4", + "info_dict": { + "title": "Attorney General Eric Holder on Voting Rights Act Decision" + }, + "skip": "Requires rtmpdump" ++ }, + { + "name": "Wimp", + "url": "http://www.wimp.com/deerfence/", + "file": "deerfence.flv", + "md5": "8b215e2e0168c6081a1cf84b2846a2b5", + "info_dict": { + "title": "Watch Till End: Herd of deer jump over a fence." + } } ] diff --cc youtube_dl/extractor/__init__.py index eaa213609,82927610a..2750fc8f9 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@@ -133,7 -133,7 +134,8 @@@ def gen_extractors() VevoIE(), JukeboxIE(), TudouIE(), + CSpanIE(), + WimpIE(), GenericIE() ] diff --cc youtube_dl/extractor/wimp.py index 000000000,a548e0fa0..84f065a3d mode 000000,100644..100644 --- a/youtube_dl/extractor/wimp.py +++ b/youtube_dl/extractor/wimp.py @@@ -1,0 -1,26 +1,28 @@@ + import re + import base64 ++ + from .common import InfoExtractor + + + class WimpIE(InfoExtractor): + _VALID_URL = r'(?:http://)?(?:www\.)?wimp\.com/([^/]+)/' + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group(1) + webpage = self._download_webpage(url, video_id) - title = self._search_regex('\',webpage, 'video title') - thumbnail_url = self._search_regex('\',webpage,'video thumbnail') - googleString = self._search_regex("googleCode = '(.*?)'", webpage,'file url') ++ title = self._search_regex(r'',webpage, 'video title') ++ thumbnail_url = self._search_regex(r'', webpage,'video thumbnail') ++ googleString = self._search_regex("googleCode = '(.*?)'", webpage, 'file url') + googleString = base64.b64decode(googleString).decode('ascii') + final_url = self._search_regex('","(.*?)"', googleString,'final video url') - ext = final_url.split('.')[-1] ++ ext = final_url.rpartition(u'.')[2] ++ + return [{ + 'id': video_id, + 'url': final_url, + 'ext': ext, + 'title': title, + 'thumbnail': thumbnail_url, + }] +