2 from __future__ import unicode_literals
6 from .common import InfoExtractor
13 class ScreenwaveMediaIE(InfoExtractor):
14 _VALID_URL = r'http://player\.screenwavemedia\.com/play/[a-zA-Z]+\.php\?[^"]*\bid=(?P<id>.+)'
17 'url': 'http://player.screenwavemedia.com/play/play.php?playerdiv=videoarea&companiondiv=squareAd&id=Cinemassacre-19911',
18 'only_matching': True,
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23 playerdata = self._download_webpage(url, video_id, 'Downloading player webpage')
25 vidtitle = self._search_regex(
26 r'\'vidtitle\'\s*:\s*"([^"]+)"', playerdata, 'vidtitle').replace('\\/', '/')
27 vidurl = self._search_regex(
28 r'\'vidurl\'\s*:\s*"([^"]+)"', playerdata, 'vidurl').replace('\\/', '/')
32 mobj = re.search(r"'videoserver'\s*:\s*'(?P<videoserver>[^']+)'", playerdata)
34 videoserver = mobj.group('videoserver')
35 mobj = re.search(r'\'vidid\'\s*:\s*"(?P<vidid>[^\']+)"', playerdata)
36 vidid = mobj.group('vidid') if mobj else video_id
37 videolist_url = 'http://%s/vod/smil:%s.smil/jwplayer.smil' % (videoserver, vidid)
39 mobj = re.search(r"file\s*:\s*'(?P<smil>http.+?/jwplayer\.smil)'", playerdata)
41 videolist_url = mobj.group('smil')
44 videolist = self._download_xml(videolist_url, video_id, 'Downloading videolist XML')
46 baseurl = vidurl[:vidurl.rfind('/') + 1]
47 for video in videolist.findall('.//video'):
48 src = video.get('src')
51 file_ = src.partition(':')[-1]
52 width = int_or_none(video.get('width'))
53 height = int_or_none(video.get('height'))
54 bitrate = int_or_none(video.get('system-bitrate'), scale=1000)
56 'url': baseurl + file_,
57 'format_id': src.rpartition('.')[0].rpartition('_')[-1],
70 formats.append(format)
75 self._sort_formats(formats)
84 class CinemassacreIE(InfoExtractor):
85 _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>[^?#/]+)'
88 'url': 'http://cinemassacre.com/2012/11/10/avgn-the-movie-trailer/',
89 'md5': 'fde81fbafaee331785f58cd6c0d46190',
91 'id': 'Cinemassacre-19911',
93 'upload_date': '20121110',
94 'title': '“Angry Video Game Nerd: The Movie” – Trailer',
95 'description': 'md5:fb87405fcb42a331742a0dce2708560b',
99 'url': 'http://cinemassacre.com/2013/10/02/the-mummys-hand-1940',
100 'md5': 'd72f10cd39eac4215048f62ab477a511',
102 'id': 'Cinemassacre-521be8ef82b16',
104 'upload_date': '20131002',
105 'title': 'The Mummy’s Hand (1940)',
110 def _real_extract(self, url):
111 mobj = re.match(self._VALID_URL, url)
112 display_id = mobj.group('display_id')
113 video_date = mobj.group('date_y') + mobj.group('date_m') + mobj.group('date_d')
115 webpage = self._download_webpage(url, display_id)
117 playerdata_url = self._search_regex(
118 r'src="(http://player\.screenwavemedia\.com/play/[a-zA-Z]+\.php\?[^"]*\bid=.+?)"',
119 webpage, 'player data URL')
120 video_title = self._html_search_regex(
121 r'<title>(?P<title>.+?)\|', webpage, 'title')
122 video_description = self._html_search_regex(
123 r'<div class="entry-content">(?P<description>.+?)</div>',
124 webpage, 'description', flags=re.DOTALL, fatal=False)
125 video_thumbnail = self._og_search_thumbnail(webpage)
128 '_type': 'url_transparent',
129 'display_id': display_id,
130 'title': video_title,
131 'description': video_description,
132 'upload_date': video_date,
133 'thumbnail': video_thumbnail,
134 'url': playerdata_url,
138 class TeamFourIE(InfoExtractor):
139 _VALID_URL = r'https?://(?:www\.)?teamfourstar\.com/video/(?P<id>[a-z0-9\-]+)/?'
141 'url': 'http://teamfourstar.com/video/a-moment-with-tfs-episode-4/',
143 'id': 'TeamFourStar-5292a02f20bfa',
145 'upload_date': '20130401',
146 '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',
147 'title': 'A Moment With TFS Episode 4',
151 def _real_extract(self, url):
152 display_id = self._match_id(url)
153 webpage = self._download_webpage(url, display_id)
155 playerdata_url = self._search_regex(
156 r'src="(http://player\.screenwavemedia\.com/play/[a-zA-Z]+\.php\?[^"]*\bid=.+?)"',
157 webpage, 'player data URL')
159 video_title = self._html_search_regex(
160 r'<div class="heroheadingtitle">(?P<title>.+?)</div>',
162 video_date = unified_strdate(self._html_search_regex(
163 r'<div class="heroheadingdate">(?P<date>.+?)</div>',
164 webpage, 'date', fatal=False))
165 video_description = self._html_search_regex(
166 r'(?s)<div class="postcontent">(?P<description>.+?)</div>',
167 webpage, 'description', fatal=False)
168 video_thumbnail = self._og_search_thumbnail(webpage)
171 '_type': 'url_transparent',
172 'display_id': display_id,
173 'title': video_title,
174 'description': video_description,
175 'upload_date': video_date,
176 'thumbnail': video_thumbnail,
177 'url': playerdata_url,