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<id>[^/]+/[^/]+/[^/]+/\d+)'
15 'url': 'http://my.mail.ru/video/top#video=/mail/sonypicturesrus/75/76',
16 'md5': 'dea205f03120046894db4ebb6159879a',
20 'title': 'Новый Человек-Паук. Высокое напряжение. Восстание Электро',
21 'timestamp': 1393232740,
22 'upload_date': '20140224',
23 'uploader': 'sonypicturesrus',
24 'uploader_id': 'sonypicturesrus@mail.ru',
29 def _real_extract(self, url):
30 mobj = re.match(self._VALID_URL, url)
31 video_id = mobj.group('id')
33 video_data = self._download_json(
34 'http://videoapi.my.mail.ru/videos/%s.json?new=1' % video_id, video_id, 'Downloading video JSON')
36 author = video_data['author']
37 uploader = author['name']
38 uploader_id = author['id']
40 movie = video_data['movie']
41 content_id = str(movie['contentId'])
42 title = movie['title']
43 thumbnail = movie['poster']
44 duration = movie['duration']
46 view_count = video_data['views_count']
51 'format_id': video['name'],
52 } for video in video_data['videos']
58 'thumbnail': thumbnail,
59 'timestamp': video_data['timestamp'],
61 'uploader_id': uploader_id,
63 'view_count': view_count,