[wimp] minor readability improvements (#940)
authorPhilipp Hagemeister <phihag@phihag.de>
Wed, 26 Jun 2013 16:22:26 +0000 (18:22 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Wed, 26 Jun 2013 16:22:42 +0000 (18:22 +0200)
1  2 
test/tests.json
youtube_dl/extractor/__init__.py
youtube_dl/extractor/wimp.py

diff --cc test/tests.json
index aa540792eed74a031e3fa570732af78b638cbfd7,816fabf70e6a9aec466ca3956d89670785b41b0a..ebc7a123c1de30a00941abad2f7e916d6e0991fb
          "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."
+     }
    }
  ]
index eaa213609f549c212d3962bc49047ea94a88d407,82927610ab1a141ce0a3ab94ef16cef57f248000..2750fc8f90e51bc0a84afd56d9555a70947ceb76
@@@ -133,7 -133,7 +134,8 @@@ def gen_extractors()
          VevoIE(),
          JukeboxIE(),
          TudouIE(),
 +        CSpanIE(),
+         WimpIE(),
          GenericIE()
      ]
  
index 0000000000000000000000000000000000000000,a548e0fa0668c154a7b3a36f48fe192d11c4e4d7..84f065a3df97c4d4b1c40c37cac5d4494d6ff8f6
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,26 +1,28 @@@
 -        title = self._search_regex('\<meta name\="description" content="(.+?)" \/\>',webpage, 'video title')
 -        thumbnail_url = self._search_regex('\<meta property\=\"og\:image" content\=\"(.+?)\" />',webpage,'video thumbnail')
 -        googleString = self._search_regex("googleCode = '(.*?)'", webpage,'file url')
+ 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)
 -        ext = final_url.split('.')[-1]
++        title = self._search_regex(r'<meta name="description" content="(.+?)" />',webpage, 'video title')
++        thumbnail_url = self._search_regex(r'<meta property="og\:image" content="(.+?)" />', 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.rpartition(u'.')[2]
++
+         return [{
+             'id':        video_id,
+             'url':       final_url,
+             'ext':       ext,
+             'title':     title,
+             'thumbnail': thumbnail_url,
+         }]