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