]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/movieclips.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
15 class MovieClipsIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://movieclips\.com/(?P<id>[\da-zA-Z]+)(?:-(?P<display_id>[\da-z-]+))?'
18 'url': 'http://movieclips.com/Wy7ZU-my-week-with-marilyn-movie-do-you-love-me/',
21 'display_id': 'my-week-with-marilyn-movie-do-you-love-me',
23 'title': 'My Week with Marilyn - Do You Love Me?',
24 'description': 'md5:e86795bd332fe3cff461e7c8dc542acb',
25 'thumbnail': 're:^https?://.*\.jpg$',
29 'skip_download': True,
33 def _real_extract(self
, url
):
34 mobj
= re
.match(self
._VALID
_URL
, url
)
35 video_id
= mobj
.group('id')
36 display_id
= mobj
.group('display_id')
37 show_id
= display_id
or video_id
39 config
= self
._download
_xml
(
40 'http://config.movieclips.com/player/config/%s' % video_id
,
41 show_id
, 'Downloading player config')
43 if config
.find('./country-region').text
== 'false':
45 '%s said: %s' % (self
.IE_NAME
, config
.find('./region_alert').text
), expected
=True)
47 properties
= config
.find('./video/properties')
48 smil_file
= properties
.attrib
['smil_file']
50 smil
= self
._download
_xml
(smil_file
, show_id
, 'Downloading SMIL')
51 base_url
= smil
.find('./head/meta').attrib
['base']
54 for video
in smil
.findall('./body/switch/video'):
55 vbr
= int(video
.attrib
['system-bitrate']) / 1000
56 src
= video
.attrib
['src']
60 'ext': src
.split(':')[0],
62 'format_id': '%dk' % vbr
,
65 self
._sort
_formats
(formats
)
67 title
= '%s - %s' % (properties
.attrib
['clip_movie_title'], properties
.attrib
['clip_title'])
68 description
= clean_html(compat_str(properties
.attrib
['clip_description']))
69 thumbnail
= properties
.attrib
['image']
70 categories
= properties
.attrib
['clip_categories'].split(',')
74 'display_id': display_id
,
76 'description': description
,
77 'thumbnail': thumbnail
,
78 'categories': categories
,