]>
Commit | Line | Data |
---|---|---|
ba40a746 PH |
1 | from __future__ import unicode_literals |
2 | ||
0c7c19d6 PH |
3 | import re |
4 | import time | |
dcca796c | 5 | import xml.etree.ElementTree |
0c7c19d6 PH |
6 | |
7 | from .common import InfoExtractor | |
ba40a746 PH |
8 | from ..utils import ( |
9 | ExtractorError, | |
10 | parse_duration, | |
11 | ) | |
0c7c19d6 PH |
12 | |
13 | ||
14 | class ClipfishIE(InfoExtractor): | |
ba40a746 | 15 | IE_NAME = 'clipfish' |
0c7c19d6 PH |
16 | |
17 | _VALID_URL = r'^https?://(?:www\.)?clipfish\.de/.*?/video/(?P<id>[0-9]+)/' | |
18 | _TEST = { | |
ba40a746 PH |
19 | 'url': 'http://www.clipfish.de/special/game-trailer/video/3966754/fifa-14-e3-2013-trailer/', |
20 | 'md5': '2521cd644e862936cf2e698206e47385', | |
21 | 'info_dict': { | |
22 | 'id': '3966754', | |
23 | 'ext': 'mp4', | |
24 | 'title': 'FIFA 14 - E3 2013 Trailer', | |
25 | 'duration': 82, | |
5e09d6ab PH |
26 | }, |
27 | u'skip': 'Blocked in the US' | |
0c7c19d6 PH |
28 | } |
29 | ||
30 | def _real_extract(self, url): | |
31 | mobj = re.match(self._VALID_URL, url) | |
32 | video_id = mobj.group(1) | |
33 | ||
34 | info_url = ('http://www.clipfish.de/devxml/videoinfo/%s?ts=%d' % | |
35 | (video_id, int(time.time()))) | |
e26f8712 | 36 | doc = self._download_xml( |
0c7c19d6 | 37 | info_url, video_id, note=u'Downloading info page') |
0c7c19d6 PH |
38 | title = doc.find('title').text |
39 | video_url = doc.find('filename').text | |
dcca796c PH |
40 | if video_url is None: |
41 | xml_bytes = xml.etree.ElementTree.tostring(doc) | |
ba40a746 | 42 | raise ExtractorError('Cannot find video URL in document %r' % |
dcca796c | 43 | xml_bytes) |
0c7c19d6 | 44 | thumbnail = doc.find('imageurl').text |
ba40a746 | 45 | duration = parse_duration(doc.find('duration').text) |
0c7c19d6 PH |
46 | |
47 | return { | |
48 | 'id': video_id, | |
49 | 'title': title, | |
50 | 'url': video_url, | |
51 | 'thumbnail': thumbnail, | |
52 | 'duration': duration, | |
53 | } |