]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cinemassacre.py
6925b96c2ee1fd1e09624638805597259b068dcd
4 from .common
import InfoExtractor
10 class CinemassacreIE(InfoExtractor
):
11 _VALID_URL
= r
'(?:http://)?(?:www\.)?(?P<url>cinemassacre\.com/(?P<date_Y>[0-9]{4})/(?P<date_m>[0-9]{2})/(?P<date_d>[0-9]{2})/.+?)(?:[/?].*)?'
13 u
'url': u
'http://cinemassacre.com/2012/11/10/avgn-the-movie-trailer/',
14 u
'file': u
'19911.flv',
16 u
'upload_date': u
'20121110',
17 u
'title': u
'“Angry Video Game Nerd: The Movie” – Trailer',
18 u
'description': u
'md5:fb87405fcb42a331742a0dce2708560b',
22 u
'skip_download': True,
26 u
'url': u
'http://cinemassacre.com/2013/10/02/the-mummys-hand-1940',
27 u
'file': u
'521be8ef82b16.flv',
29 u
'upload_date': u
'20131002',
30 u
'title': u
'The Mummy’s Hand (1940)',
34 u
'skip_download': True,
38 def _real_extract(self
, url
):
39 mobj
= re
.match(self
._VALID
_URL
, url
)
41 webpage_url
= u
'http://' + mobj
.group('url')
42 webpage
= self
._download
_webpage
(webpage_url
, None) # Don't know video id yet
43 video_date
= mobj
.group('date_Y') + mobj
.group('date_m') + mobj
.group('date_d')
44 mobj
= re
.search(r
'src="(?P<embed_url>http://player\.screenwavemedia\.com/play/(?:embed|player)\.php\?id=(?:Cinemassacre-)?(?P<video_id>.+?))"', webpage
)
46 raise ExtractorError(u
'Can\'t extract embed url and video id')
47 playerdata_url
= mobj
.group(u
'embed_url')
48 video_id
= mobj
.group(u
'video_id')
50 video_title
= self
._html
_search
_regex
(r
'<title>(?P<title>.+?)\|',
52 video_description
= self
._html
_search
_regex
(r
'<div class="entry-content">(?P<description>.+?)</div>',
53 webpage
, u
'description', flags
=re
.DOTALL
, fatal
=False)
54 if len(video_description
) == 0:
55 video_description
= None
57 playerdata
= self
._download
_webpage
(playerdata_url
, video_id
)
58 base_url
= self
._html
_search
_regex
(r
'\'streamer
\': \'(?P
<base_url
>rtmp
://.*?
)/(?
:vod|Cinemassacre
)\'',
59 playerdata, u'base_url
')
60 base_url += '/Cinemassacre
/'
61 # Important: The file names in playerdata are not used by the player and even wrong for some videos
62 sd_file = 'Cinemassacre
-%s_high
.mp4
' % video_id
63 hd_file = 'Cinemassacre
-%s.mp4
' % video_id
64 video_thumbnail = 'http
://image
.screenwavemedia
.com
/Cinemassacre
/Cinemassacre
-%s_thumb
_640x
360.jpg
' % video_id
68 'url
': base_url + sd_file,
74 'url
': base_url + hd_file,
85 'description
': video_description,
86 'upload_date
': video_date,
87 'thumbnail
': video_thumbnail,
89 # TODO: Remove when #980 has been merged
90 info.update(formats[-1])