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 TeamFourIE(InfoExtractor):
85 _VALID_URL = r'https?://(?:www\.)?teamfourstar\.com/video/(?P<id>[a-z0-9\-]+)/?'
87 'url': 'http://teamfourstar.com/video/a-moment-with-tfs-episode-4/',
89 'id': 'TeamFourStar-5292a02f20bfa',
91 'upload_date': '20130401',
92 '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',
93 'title': 'A Moment With TFS Episode 4',
97 def _real_extract(self, url):
98 display_id = self._match_id(url)
99 webpage = self._download_webpage(url, display_id)
101 playerdata_url = self._search_regex(
102 r'src="(http://player\.screenwavemedia\.com/play/[a-zA-Z]+\.php\?[^"]*\bid=.+?)"',
103 webpage, 'player data URL')
105 video_title = self._html_search_regex(
106 r'<div class="heroheadingtitle">(?P<title>.+?)</div>',
108 video_date = unified_strdate(self._html_search_regex(
109 r'<div class="heroheadingdate">(?P<date>.+?)</div>',
110 webpage, 'date', fatal=False))
111 video_description = self._html_search_regex(
112 r'(?s)<div class="postcontent">(?P<description>.+?)</div>',
113 webpage, 'description', fatal=False)
114 video_thumbnail = self._og_search_thumbnail(webpage)
117 '_type': 'url_transparent',
118 'display_id': display_id,
119 'title': video_title,
120 'description': video_description,
121 'upload_date': video_date,
122 'thumbnail': video_thumbnail,
123 'url': playerdata_url,