]>
Commit | Line | Data |
---|---|---|
ba3881df | 1 | import re |
ba3881df AL |
2 | |
3 | from .common import InfoExtractor | |
4 | ||
5 | ||
6 | class AnitubeIE(InfoExtractor): | |
7 | IE_NAME = u'anitube.se' | |
8f053519 | 8 | _VALID_URL = r'https?://(?:www\.)?anitube\.se/video/(?P<id>\d+)' |
ba3881df AL |
9 | |
10 | _TEST = { | |
11 | u'url': u'http://www.anitube.se/video/36621', | |
8f053519 PH |
12 | u'md5': u'59d0eeae28ea0bc8c05e7af429998d43', |
13 | u'file': u'36621.mp4', | |
ba3881df AL |
14 | u'info_dict': { |
15 | u'id': u'36621', | |
16 | u'ext': u'mp4', | |
17 | u'title': u'Recorder to Randoseru 01', | |
18 | }, | |
f2e87ef4 | 19 | u'skip': u'Blocked in the US', |
ba3881df AL |
20 | } |
21 | ||
22 | def _real_extract(self, url): | |
23 | mobj = re.match(self._VALID_URL, url) | |
24 | video_id = mobj.group('id') | |
25 | ||
26 | webpage = self._download_webpage(url, video_id) | |
ba3881df AL |
27 | key = self._html_search_regex(r'http://www\.anitube\.se/embed/([A-Za-z0-9_-]*)', |
28 | webpage, u'key') | |
29 | ||
e26f8712 | 30 | config_xml = self._download_xml('http://www.anitube.se/nuevo/econfig.php?key=%s' % key, |
ba3881df | 31 | key) |
ba3881df AL |
32 | |
33 | video_title = config_xml.find('title').text | |
34 | ||
ba3881df | 35 | formats = [] |
ba3881df AL |
36 | video_url = config_xml.find('file') |
37 | if video_url is not None: | |
38 | formats.append({ | |
39 | 'format_id': 'sd', | |
40 | 'url': video_url.text, | |
41 | }) | |
ba3881df AL |
42 | video_url = config_xml.find('filehd') |
43 | if video_url is not None: | |
44 | formats.append({ | |
45 | 'format_id': 'hd', | |
46 | 'url': video_url.text, | |
47 | }) | |
48 | ||
49 | return { | |
50 | 'id': video_id, | |
51 | 'title': video_title, | |
ba3881df AL |
52 | 'formats': formats |
53 | } |