]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videofyme.py
New upstream version 2019.09.01
[youtubedl] / youtube_dl / extractor / videofyme.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import (
5 int_or_none,
6 parse_iso8601,
7 )
8
9
10 class VideofyMeIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.videofy\.me/.+?|p\.videofy\.me/v)/(?P<id>\d+)(&|#|$)'
12 IE_NAME = 'videofy.me'
13
14 _TEST = {
15 'url': 'http://www.videofy.me/thisisvideofyme/1100701',
16 'md5': 'c77d700bdc16ae2e9f3c26019bd96143',
17 'info_dict': {
18 'id': '1100701',
19 'ext': 'mp4',
20 'title': 'This is VideofyMe',
21 'description': '',
22 'upload_date': '20130326',
23 'timestamp': 1364288959,
24 'uploader': 'VideofyMe',
25 'uploader_id': 'thisisvideofyme',
26 'view_count': int,
27 'likes': int,
28 'comment_count': int,
29 },
30 }
31
32 def _real_extract(self, url):
33 video_id = self._match_id(url)
34
35 config = self._download_json('http://vf-player-info-loader.herokuapp.com/%s.json' % video_id, video_id)['videoinfo']
36
37 video = config.get('video')
38 blog = config.get('blog', {})
39
40 return {
41 'id': video_id,
42 'title': video['title'],
43 'url': video['sources']['source']['url'],
44 'thumbnail': video.get('thumb'),
45 'description': video.get('description'),
46 'timestamp': parse_iso8601(video.get('date')),
47 'uploader': blog.get('name'),
48 'uploader_id': blog.get('identifier'),
49 'view_count': int_or_none(self._search_regex(r'([0-9]+)', video.get('views'), 'view count', fatal=False)),
50 'likes': int_or_none(video.get('likes')),
51 'comment_count': int_or_none(video.get('nrOfComments')),
52 }