]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mailru.py
ab1300185099a20835fdde08b88635ceacafe191
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class MailRuIE(InfoExtractor
):
11 IE_DESC
= 'Видео@Mail.Ru'
12 _VALID_URL
= r
'http://(?:www\.)?my\.mail\.ru/(?:video/.*#video=/?(?P<idv1>(?:[^/]+/){3}\d+)|(?:(?P<idv2prefix>(?:[^/]+/){2})video/(?P<idv2suffix>[^/]+/\d+))\.html)'
16 'url': 'http://my.mail.ru/video/top#video=/mail/sonypicturesrus/75/76',
17 'md5': 'dea205f03120046894db4ebb6159879a',
21 'title': 'Новый Человек-Паук. Высокое напряжение. Восстание Электро',
22 'timestamp': 1393232740,
23 'upload_date': '20140224',
24 'uploader': 'sonypicturesrus',
25 'uploader_id': 'sonypicturesrus@mail.ru',
28 'skip': 'Not accessible from Travis CI server',
31 'url': 'http://my.mail.ru/corp/hitech/video/news_hi-tech_mail_ru/1263.html',
32 'md5': '00a91a58c3402204dcced523777b475f',
34 'id': '46843144_1263',
36 'title': 'Samsung Galaxy S5 Hammer Smash Fail Battery Explosion',
37 'timestamp': 1397217632,
38 'upload_date': '20140411',
40 'uploader_id': 'hitech@corp.mail.ru',
43 'skip': 'Not accessible from Travis CI server',
47 def _real_extract(self
, url
):
48 mobj
= re
.match(self
._VALID
_URL
, url
)
49 video_id
= mobj
.group('idv1')
52 video_id
= mobj
.group('idv2prefix') + mobj
.group('idv2suffix')
54 video_data
= self
._download
_json
(
55 'http://api.video.mail.ru/videos/%s.json?new=1' % video_id
, video_id
, 'Downloading video JSON')
57 author
= video_data
['author']
58 uploader
= author
['name']
59 uploader_id
= author
.get('id') or author
.get('email')
60 view_count
= video_data
.get('views_count')
62 meta_data
= video_data
['meta']
63 content_id
= '%s_%s' % (
64 meta_data
.get('accId', ''), meta_data
['itemId'])
65 title
= meta_data
['title']
66 if title
.endswith('.mp4'):
68 thumbnail
= meta_data
['poster']
69 duration
= meta_data
['duration']
70 timestamp
= meta_data
['timestamp']
75 'format_id': video
['key'],
76 'height': int(video
['key'].rstrip('p'))
77 } for video
in video_data
['videos']
79 self
._sort
_formats
(formats
)
84 'thumbnail': thumbnail
,
85 'timestamp': timestamp
,
87 'uploader_id': uploader_id
,
89 'view_count': view_count
,