]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dump.py
6b651778afa2faa57237314cde7a25f3ebb06278
[youtubedl] / youtube_dl / extractor / dump.py
1 # encoding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class DumpIE(InfoExtractor):
10 _VALID_URL = r'^https?://(?:www\.)?dump\.com/(?P<id>[a-zA-Z0-9]+)/'
11
12 _TEST = {
13 'url': 'http://www.dump.com/oneus/',
14 'md5': 'ad71704d1e67dfd9e81e3e8b42d69d99',
15 'info_dict': {
16 'id': 'oneus',
17 'ext': 'flv',
18 'title': "He's one of us.",
19 'thumbnail': 're:^https?://.*\.jpg$',
20 },
21 }
22
23 def _real_extract(self, url):
24 m = re.match(self._VALID_URL, url)
25 video_id = m.group('id')
26
27 webpage = self._download_webpage(url, video_id)
28 video_url = self._search_regex(
29 r's1.addVariable\("file",\s*"([^"]+)"', webpage, 'video URL')
30
31 thumb = self._og_search_thumbnail(webpage)
32 title = self._search_regex(r'<b>([^"]+)</b>', webpage, 'title')
33
34 return {
35 'id': video_id,
36 'title': title,
37 'url': video_url,
38 'thumbnail': thumb,
39 }