]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/screenwavemedia.py
d1ab66b3216d5153a5480769fb0723919f3fdb37
2 from __future__
import unicode_literals
6 from . common
import InfoExtractor
13 class ScreenwaveMediaIE ( InfoExtractor
):
14 _VALID_URL
= r
'http://player\d?\.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
)
24 playerdata
= self
._ download
_ webpage
(
25 'http://player.screenwavemedia.com/play/player.php?id= %s ' % video_id
,
26 video_id
, 'Downloading player webpage' )
28 vidtitle
= self
._ search
_ regex
(
29 r
'\' vidtitle
\' \s
*: \s
* "([^" ]+) "', playerdata, 'vidtitle').replace(' \\ /', '/')
30 vidurl = self._search_regex(
31 r' \' vidurl \' \s*:\s*" ([ ^
"]+)" ', playerdata, ' vidurl
').replace(' \\ / ', ' / ')
35 mobj = re.search(r"' videoserver
'\s*:\s*' ( ?P
< videoserver
>[ ^
']+)' ", playerdata)
37 videoserver = mobj.group('videoserver')
38 mobj = re.search(r' \' vidid \' \s*:\s*" ( ?P
< vidid
>[ ^
\' ]+) "', playerdata)
39 vidid = mobj.group('vidid') if mobj else video_id
40 videolist_url = 'http:// %s /vod/smil: %s .smil/jwplayer.smil' % (videoserver, vidid)
42 mobj = re.search(r" file \s
*: \s
* '(?P<smil>http.+?/jwplayer\.smil)' ", playerdata)
44 videolist_url = mobj.group('smil')
47 videolist = self._download_xml(videolist_url, video_id, 'Downloading videolist XML')
49 baseurl = vidurl[:vidurl.rfind('/') + 1]
50 for video in videolist.findall('.//video'):
51 src = video.get('src')
54 file_ = src.partition(':')[-1]
55 width = int_or_none(video.get('width'))
56 height = int_or_none(video.get('height'))
57 bitrate = int_or_none(video.get('system-bitrate'), scale=1000)
59 'url': baseurl + file_,
60 'format_id': src.rpartition('.')[0].rpartition('_')[-1],
73 formats.append(format)
78 self._sort_formats(formats)
87 class TeamFourIE(InfoExtractor):
88 _VALID_URL = r'https?://(?:www\.)?teamfourstar\.com/video/(?P<id>[a-z0-9\-]+)/?'
90 'url': 'http://teamfourstar.com/video/a-moment-with-tfs-episode-4/',
92 'id': 'TeamFourStar-5292a02f20bfa',
94 'upload_date': '20130401',
95 'description': 'Check out this and more on our website: http://teamfourstar.com \n TFS Store: http://sharkrobot.com/team-four-star \n Follow on Twitter: http://twitter.com/teamfourstar \n Like on FB: http://facebook.com/teamfourstar',
96 'title': 'A Moment With TFS Episode 4',
100 def _real_extract(self, url):
101 display_id = self._match_id(url)
102 webpage = self._download_webpage(url, display_id)
104 playerdata_url = self._search_regex(
105 r'src=" ( http
:// player\d?\
. screenwavemedia\
. com
/( ?
: play
/) ?
[ a
- zA
- Z
]+ \
. php
\? [ ^
"]* \b id=.+?)" ',
106 webpage, ' player data URL
')
108 video_title = self._html_search_regex(
109 r' < div
class = "heroheadingtitle" >( ?P
< title
>.+ ?
)</ div
> ',
111 video_date = unified_strdate(self._html_search_regex(
112 r' < div
class = "heroheadingdate" >( ?P
< date
>.+ ?
)</ div
> ',
113 webpage, ' date
', fatal=False))
114 video_description = self._html_search_regex(
115 r' ( ?s
)< div
class = "postcontent" >( ?P
< description
>.+ ?
)</ div
> ',
116 webpage, ' description
', fatal=False)
117 video_thumbnail = self._og_search_thumbnail(webpage)
120 ' _type
': ' url_transparent
',
121 ' display_id
': display_id,
122 ' title
': video_title,
123 ' description
': video_description,
124 ' upload_date
': video_date,
125 ' thumbnail
': video_thumbnail,
126 ' url
': playerdata_url,