]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/clipfish.py
3 import xml
.etree
.ElementTree
5 from .common
import InfoExtractor
6 from ..utils
import ExtractorError
9 class ClipfishIE(InfoExtractor
):
12 _VALID_URL
= r
'^https?://(?:www\.)?clipfish\.de/.*?/video/(?P<id>[0-9]+)/'
14 u
'url': u
'http://www.clipfish.de/special/game-trailer/video/3966754/fifa-14-e3-2013-trailer/',
15 u
'file': u
'3966754.mp4',
16 u
'md5': u
'2521cd644e862936cf2e698206e47385',
18 u
'title': u
'FIFA 14 - E3 2013 Trailer',
21 u
'skip': 'Blocked in the US'
24 def _real_extract(self
, url
):
25 mobj
= re
.match(self
._VALID
_URL
, url
)
26 video_id
= mobj
.group(1)
28 info_url
= ('http://www.clipfish.de/devxml/videoinfo/%s?ts=%d' %
29 (video_id
, int(time
.time())))
30 doc
= self
._download
_xml
(
31 info_url
, video_id
, note
=u
'Downloading info page')
32 title
= doc
.find('title').text
33 video_url
= doc
.find('filename').text
35 xml_bytes
= xml
.etree
.ElementTree
.tostring(doc
)
36 raise ExtractorError(u
'Cannot find video URL in document %r' %
38 thumbnail
= doc
.find('imageurl').text
39 duration_str
= doc
.find('duration').text
41 r
'^(?P<hours>[0-9]+):(?P<minutes>[0-9]{2}):(?P<seconds>[0-9]{2}):(?P<ms>[0-9]*)$',
45 (int(m
.group('hours')) * 60 * 60) +
46 (int(m
.group('minutes')) * 60) +
47 (int(m
.group('seconds')))
56 'thumbnail': thumbnail
,