]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/fivemin.py
5b24b921c13d497d09474fa405df5b164451dd80
1 from __future__
import unicode_literals
3 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',
44 def _real_extract(self
, url
):
45 video_id
= self
._match
_id
(url
)
46 embed_url
= 'https://embed.5min.com/playerseed/?playList=%s' % video_id
47 embed_page
= self
._download
_webpage
(embed_url
, video_id
,
48 'Downloading embed page')
49 sid
= self
._search
_regex
(r
'sid=(\d+)', embed_page
, 'sid')
50 query
= compat_urllib_parse
.urlencode({
54 'isPlayerSeed': 'true',
57 response
= self
._download
_json
(
58 'https://syn.5min.com/handlers/SenseHandler.ashx?' + query
,
60 if not response
['success']:
61 err_msg
= response
['errorMessage']
62 if err_msg
== 'ErrorVideoUserNotGeo':
63 msg
= 'Video not available from your location'
65 msg
= 'Aol said: %s' % err_msg
66 raise ExtractorError(msg
, expected
=True, video_id
=video_id
)
67 info
= response
['binding'][0]
69 second_id
= compat_str(int(video_id
[:-2]) + 1)
71 for quality
, height
in [(1, 320), (2, 480), (4, 720), (8, 1080)]:
72 if any(r
['ID'] == quality
for r
in info
['Renditions']):
74 'format_id': compat_str(quality
),
75 'url': 'http://avideos.5min.com/%s/%s/%s_%s.mp4' % (second_id
[-3:], second_id
, video_id
, quality
),
81 'title': info
['Title'],