]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mailru.py
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',
30 'url': 'http://my.mail.ru/corp/hitech/video/news_hi-tech_mail_ru/1263.html',
31 'md5': '00a91a58c3402204dcced523777b475f',
35 'title': 'Samsung Galaxy S5 Hammer Smash Fail Battery Explosion',
36 'timestamp': 1397217632,
37 'upload_date': '20140411',
39 'uploader_id': 'hitech@corp.mail.ru',
45 def _real_extract(self
, url
):
46 mobj
= re
.match(self
._VALID
_URL
, url
)
47 video_id
= mobj
.group('idv1')
50 video_id
= mobj
.group('idv2prefix') + mobj
.group('idv2suffix')
52 video_data
= self
._download
_json
(
53 'http://api.video.mail.ru/videos/%s.json?new=1' % video_id
, video_id
, 'Downloading video JSON')
55 author
= video_data
['author']
56 uploader
= author
['name']
57 uploader_id
= author
['id']
59 movie
= video_data
['movie']
60 content_id
= str(movie
['contentId'])
61 title
= movie
['title']
62 if title
.endswith('.mp4'):
64 thumbnail
= movie
['poster']
65 duration
= movie
['duration']
67 view_count
= video_data
['views_count']
72 'format_id': video
['name'],
73 } for video
in video_data
['videos']
79 'thumbnail': thumbnail
,
80 'timestamp': video_data
['timestamp'],
82 'uploader_id': uploader_id
,
84 'view_count': view_count
,