]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/hitrecord.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
4 from ..compat
import compat_str
13 class HitRecordIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?hitrecord\.org/records/(?P<id>\d+)'
16 'url': 'https://hitrecord.org/records/2954362',
17 'md5': 'fe1cdc2023bce0bbb95c39c57426aa71',
21 'title': 'A Very Different World (HITRECORD x ACLU)',
22 'description': 'md5:e62defaffab5075a5277736bead95a3d',
24 'timestamp': 1471557582,
25 'upload_date': '20160818',
26 'uploader': 'Zuzi.C12',
27 'uploader_id': '362811',
35 def _real_extract(self
, url
):
36 video_id
= self
._match
_id
(url
)
38 video
= self
._download
_json
(
39 'https://hitrecord.org/api/web/records/%s' % video_id
, video_id
)
41 title
= video
['title']
42 video_url
= video
['source_url']['mp4_url']
45 tags_list
= try_get(video
, lambda x
: x
['tags'], list)
50 if isinstance(t
, dict) and t
.get('text') and
51 isinstance(t
['text'], compat_str
)]
57 'description': clean_html(video
.get('body')),
58 'duration': float_or_none(video
.get('duration'), 1000),
59 'timestamp': int_or_none(video
.get('created_at_i')),
61 video
, lambda x
: x
['user']['username'], compat_str
),
62 'uploader_id': try_get(
63 video
, lambda x
: compat_str(x
['user']['id'])),
64 'view_count': int_or_none(video
.get('total_views_count')),
65 'like_count': int_or_none(video
.get('hearts_count')),
66 'comment_count': int_or_none(video
.get('comments_count')),