]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/fivemin.py
f9c127ce67bd7edefd22e7e7953ecce57e888d15
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
13 class FiveMinIE(InfoExtractor
):
16 (?:https?://[^/]*?5min\.com/Scripts/PlayerSeed\.js\?(.*?&)?playList=|
23 # From http://www.engadget.com/2013/11/15/ipad-mini-retina-display-review/
24 'url': 'http://pshared.5min.com/Scripts/PlayerSeed.js?sid=281&width=560&height=345&playList=518013791',
25 'md5': '4f7b0b79bf1a470e5004f7112385941d',
29 'title': 'iPad Mini with Retina Display Review',
33 # From http://on.aol.com/video/how-to-make-a-next-level-fruit-salad-518086247
34 'url': '5min:518086247',
35 'md5': 'e539a9dd682c288ef5a498898009f69e',
39 'title': 'How to Make a Next-Level Fruit Salad',
45 def _build_result(cls
, video_id
):
46 return cls
.url_result('5min:%s' % video_id
, cls
.ie_key())
48 def _real_extract(self
, url
):
49 mobj
= re
.match(self
._VALID
_URL
, url
)
50 video_id
= mobj
.group('id')
51 embed_url
= 'https://embed.5min.com/playerseed/?playList=%s' % video_id
52 embed_page
= self
._download
_webpage
(embed_url
, video_id
,
53 'Downloading embed page')
54 sid
= self
._search
_regex
(r
'sid=(\d+)', embed_page
, 'sid')
55 query
= compat_urllib_parse
.urlencode({
59 'isPlayerSeed': 'true',
62 response
= self
._download
_json
(
63 'https://syn.5min.com/handlers/SenseHandler.ashx?' + query
,
65 if not response
['success']:
66 err_msg
= response
['errorMessage']
67 if err_msg
== 'ErrorVideoUserNotGeo':
68 msg
= 'Video not available from your location'
70 msg
= 'Aol said: %s' % err_msg
71 raise ExtractorError(msg
, expected
=True, video_id
=video_id
)
72 info
= response
['binding'][0]
74 second_id
= compat_str(int(video_id
[:-2]) + 1)
76 for quality
, height
in [(1, 320), (2, 480), (4, 720), (8, 1080)]:
77 if any(r
['ID'] == quality
for r
in info
['Renditions']):
79 'format_id': compat_str(quality
),
80 'url': 'http://avideos.5min.com/%s/%s/%s_%s.mp4' % (second_id
[-3:], second_id
, video_id
, quality
),
86 'title': info
['Title'],