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