2 from __future__ import unicode_literals
6 from .common import InfoExtractor
15 class ScreenwaveMediaIE(InfoExtractor):
16 _VALID_URL = r'http://player\.screenwavemedia\.com/play/[a-zA-Z]+\.php\?[^"]*\bid=(?P<id>.+)'
19 'url': 'http://player.screenwavemedia.com/play/play.php?playerdiv=videoarea&companiondiv=squareAd&id=Cinemassacre-19911',
20 'only_matching': True,
23 def _real_extract(self, url):
24 video_id = self._match_id(url)
25 playerdata = self._download_webpage(url, video_id, 'Downloading player webpage')
27 vidtitle = self._search_regex(
28 r'\'vidtitle\'\s*:\s*"([^"]+)"', playerdata, 'vidtitle').replace('\\/', '/')
29 vidurl = self._search_regex(
30 r'\'vidurl\'\s*:\s*"([^"]+)"', playerdata, 'vidurl').replace('\\/', '/')
34 mobj = re.search(r"'videoserver'\s*:\s*'(?P<videoserver>[^']+)'", playerdata)
36 videoserver = mobj.group('videoserver')
37 mobj = re.search(r'\'vidid\'\s*:\s*"(?P<vidid>[^\']+)"', playerdata)
38 vidid = mobj.group('vidid') if mobj else video_id
39 videolist_url = 'http://%s/vod/smil:%s.smil/jwplayer.smil' % (videoserver, vidid)
41 mobj = re.search(r"file\s*:\s*'(?P<smil>http.+?/jwplayer\.smil)'", playerdata)
43 videolist_url = mobj.group('smil')
46 videolist = self._download_xml(videolist_url, video_id, 'Downloading videolist XML')
48 baseurl = vidurl[:vidurl.rfind('/') + 1]
49 for video in videolist.findall('.//video'):
50 src = video.get('src')
53 file_ = src.partition(':')[-1]
54 width = int_or_none(video.get('width'))
55 height = int_or_none(video.get('height'))
56 bitrate = int_or_none(video.get('system-bitrate'), scale=1000)
58 'url': baseurl + file_,
59 'format_id': src.rpartition('.')[0].rpartition('_')[-1],
72 formats.append(format)
77 self._sort_formats(formats)
86 class CinemassacreIE(InfoExtractor):
87 _VALID_URL = 'https?://(?:www\.)?cinemassacre\.com/(?P<date_y>[0-9]{4})/(?P<date_m>[0-9]{2})/(?P<date_d>[0-9]{2})/(?P<display_id>[^?#/]+)'
90 'url': 'http://cinemassacre.com/2012/11/10/avgn-the-movie-trailer/',
91 'md5': 'fde81fbafaee331785f58cd6c0d46190',
93 'id': 'Cinemassacre-19911',
95 'upload_date': '20121110',
96 'title': '“Angry Video Game Nerd: The Movie” – Trailer',
97 'description': 'md5:fb87405fcb42a331742a0dce2708560b',
101 'url': 'http://cinemassacre.com/2013/10/02/the-mummys-hand-1940',
102 'md5': 'd72f10cd39eac4215048f62ab477a511',
104 'id': 'Cinemassacre-521be8ef82b16',
106 'upload_date': '20131002',
107 'title': 'The Mummy’s Hand (1940)',
112 def _real_extract(self, url):
113 mobj = re.match(self._VALID_URL, url)
114 display_id = mobj.group('display_id')
115 video_date = mobj.group('date_y') + mobj.group('date_m') + mobj.group('date_d')
117 webpage = self._download_webpage(url, display_id)
119 playerdata_url = self._search_regex(
120 r'src="(http://player\.screenwavemedia\.com/play/[a-zA-Z]+\.php\?[^"]*\bid=.+?)"',
121 webpage, 'player data URL')
122 video_title = self._html_search_regex(
123 r'<title>(?P<title>.+?)\|', webpage, 'title')
124 video_description = self._html_search_regex(
125 r'<div class="entry-content">(?P<description>.+?)</div>',
126 webpage, 'description', flags=re.DOTALL, fatal=False)
127 video_thumbnail = self._og_search_thumbnail(webpage)
130 '_type': 'url_transparent',
131 'display_id': display_id,
132 'title': video_title,
133 'description': video_description,
134 'upload_date': video_date,
135 'thumbnail': video_thumbnail,
136 'url': playerdata_url,
140 class TeamFourIE(InfoExtractor):
141 _VALID_URL = r'https?://(?:www\.)?teamfourstar\.com/video/(?P<id>[a-z0-9\-]+)/?'
143 'url': 'http://teamfourstar.com/video/a-moment-with-tfs-episode-4/',
145 'id': 'TeamFourStar-5292a02f20bfa',
147 'upload_date': '20130401',
148 'description': 'Check out this and more on our website: http://teamfourstar.com\nTFS Store: http://sharkrobot.com/team-four-star\nFollow on Twitter: http://twitter.com/teamfourstar\nLike on FB: http://facebook.com/teamfourstar',
149 'title': 'A Moment With TFS Episode 4',
153 def _real_extract(self, url):
154 display_id = self._match_id(url)
155 webpage = self._download_webpage(url, display_id)
157 playerdata_url = self._search_regex(
158 r'src="(http://player\.screenwavemedia\.com/play/[a-zA-Z]+\.php\?[^"]*\bid=.+?)"',
159 webpage, 'player data URL')
161 video_title = self._html_search_regex(
162 r'<div class="heroheadingtitle">(?P<title>.+?)</div>',
164 video_date = unified_strdate(self._html_search_regex(
165 r'<div class="heroheadingdate">(?P<date>.+?)</div>',
166 webpage, 'date', fatal=False))
167 video_description = self._html_search_regex(
168 r'(?s)<div class="postcontent">(?P<description>.+?)</div>',
169 webpage, 'description', fatal=False)
170 video_thumbnail = self._og_search_thumbnail(webpage)
173 '_type': 'url_transparent',
174 'display_id': display_id,
175 'title': video_title,
176 'description': video_description,
177 'upload_date': video_date,
178 'thumbnail': video_thumbnail,
179 'url': playerdata_url,