]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/clipsyndicate.py
d4fc869732a8ae15e60f0963ef3418abac1a9201
2 import xml
.etree
.ElementTree
4 from .common
import InfoExtractor
10 class ClipsyndicateIE(InfoExtractor
):
11 _VALID_URL
= r
'http://www\.clipsyndicate\.com/video/play(list/\d+)?/(?P<id>\d+)'
14 u
'url': u
'http://www.clipsyndicate.com/video/play/4629301/brick_briscoe',
15 u
'md5': u
'4d7d549451bad625e0ff3d7bd56d776c',
19 u
'title': u
'Brick Briscoe',
24 def _real_extract(self
, url
):
25 mobj
= re
.match(self
._VALID
_URL
, url
)
26 video_id
= mobj
.group('id')
27 js_player
= self
._download
_webpage
(
28 'http://eplayer.clipsyndicate.com/embed/player.js?va_id=%s' % video_id
,
29 video_id
, u
'Downlaoding player')
30 # it includes a required token
31 flvars
= self
._search
_regex
(r
'flvars: "(.*?)"', js_player
, u
'flvars')
33 playlist_page
= self
._download
_webpage
(
34 'http://eplayer.clipsyndicate.com/osmf/playlist?%s' % flvars
,
35 video_id
, u
'Downloading video info')
37 playlist_page
= re
.sub('&', '&', playlist_page
)
38 pdoc
= xml
.etree
.ElementTree
.fromstring(playlist_page
.encode('utf-8'))
40 track_doc
= pdoc
.find('trackList/track')
42 node
= find_xpath_attr(track_doc
, './/param', 'name', name
)
44 return node
.attrib
['value']
48 'title': find_param('title'),
49 'url': track_doc
.find('location').text
,
50 'thumbnail': find_param('thumbnail'),
51 'duration': int(find_param('duration')),