2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class ScreenwaveMediaIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://player\d?\.screenwavemedia\.com/(?:play/)?[a-zA-Z]+\.php\?.*\bid=(?P<id>[A-Za-z0-9-]+)'
16 EMBED_PATTERN
= r
'src=(["\'])(?P
<url
>(?
:https?
:)?
//player\d?\
.screenwavemedia\
.com
/(?
:play
/)?
[a
-zA
-Z
]+\
.php
\?.*\bid
=.+?
)\
1'
18 'url
': 'http
://player
.screenwavemedia
.com
/play
/play
.php?playerdiv
=videoarea
&companiondiv
=squareAd
&id=Cinemassacre
-19911',
19 'only_matching
': True,
22 def _real_extract(self, url):
23 video_id = self._match_id(url)
25 playerdata = self._download_webpage(
26 'http
://player
.screenwavemedia
.com
/player
.php?
id=%s' % video_id,
27 video_id, 'Downloading player webpage
')
29 vidtitle = self._search_regex(
30 r'\'vidtitle
\'\s
*:\s
*"([^"]+)"', playerdata, 'vidtitle').replace('\\/', '/')
32 playerconfig = self._download_webpage(
33 'http://player.screenwavemedia.com/player.js',
34 video_id, 'Downloading playerconfig webpage')
36 videoserver = self._search_regex(r'SWMServer\s*=\s*"([\d\
.]+)"', playerdata, 'videoserver')
38 sources = self._parse_json(
43 r'sources\s*:\s*(\[[^\]]+?\])', playerconfig,
46 "' + thisObj.options.videoserver + '",
49 "' + playerVidId + '",
57 # Fallback to hardcoded sources if JS changes again
59 self.report_warning('Falling back to a hardcoded list of streams')
61 'file': 'http://%s/vod/%s_%s.mp4' % (videoserver, video_id, format_id),
63 'label': format_label,
64 } for format_id, format_label in (
65 ('low', '144p Low'), ('med', '160p Med'), ('high', '360p High'), ('hd1', '720p HD1'))]
67 'file': 'http://%s/vod/smil:%s.smil/playlist.m3u8' % (videoserver, video_id),
72 for source in sources:
73 if source['type'] == 'hls':
74 formats.extend(self._extract_m3u8_formats(source['file'], video_id, ext='mp4'))
76 file_ = source.get('file')
79 format_label = source.get('label')
80 format_id = self._search_regex(
81 r'_(.+?)\.[^.]+$', file_, 'format id', default=None)
82 height = int_or_none(self._search_regex(
83 r'^(\d+)[pP]', format_label, 'height', default=None))
85 'url': source['file'],
86 'format_id': format_id,
87 'format': format_label,
88 'ext': source.get('type'),
91 self._sort_formats(formats)
100 class TeamFourIE(InfoExtractor):
101 _VALID_URL = r'https?://(?:www\.)?teamfourstar\.com/video/(?P<id>[a-z0-9\-]+)/?'
103 'url': 'http://teamfourstar.com/video/a-moment-with-tfs-episode-4/',
105 'id': 'TeamFourStar-5292a02f20bfa',
107 'upload_date': '20130401',
108 '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',
109 'title': 'A Moment With TFS Episode 4',
113 'skip_download': True,
117 def _real_extract(self, url):
118 display_id = self._match_id(url)
119 webpage = self._download_webpage(url, display_id)
121 playerdata_url = self._search_regex(
122 r'src="(http
://player\d?\
.screenwavemedia\
.com
/(?
:play
/)?
[a
-zA
-Z
]+\
.php
\?[^
"]*\bid=.+?)"',
123 webpage, 'player data URL
')
125 video_title = self._html_search_regex(
126 r'<div
class="heroheadingtitle">(?P
<title
>.+?
)</div
>',
128 video_date = unified_strdate(self._html_search_regex(
129 r'<div
class="heroheadingdate">(?P
<date
>.+?
)</div
>',
130 webpage, 'date
', fatal=False))
131 video_description = self._html_search_regex(
132 r'(?s
)<div
class="postcontent">(?P
<description
>.+?
)</div
>',
133 webpage, 'description
', fatal=False)
134 video_thumbnail = self._og_search_thumbnail(webpage)
137 '_type
': 'url_transparent
',
138 'display_id
': display_id,
139 'title
': video_title,
140 'description
': video_description,
141 'upload_date
': video_date,
142 'thumbnail
': video_thumbnail,
143 'url
': playerdata_url,