]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/dtube.py
2 from __future__
import unicode_literals
5 from socket
import timeout
7 from .common
import InfoExtractor
14 class DTubeIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?d\.tube/(?:#!/)?v/(?P<uploader_id>[0-9a-z.-]+)/(?P<id>[0-9a-z]{8})'
17 'url': 'https://d.tube/#!/v/broncnutz/x380jtr1',
18 'md5': '9f29088fa08d699a7565ee983f56a06e',
22 'title': 'Lefty 3-Rings is Back Baby!! NCAA Picks',
23 'description': 'md5:60be222088183be3a42f196f34235776',
24 'uploader_id': 'broncnutz',
25 'upload_date': '20190107',
26 'timestamp': 1546854054,
33 def _real_extract(self
, url
):
34 uploader_id
, video_id
= self
._match
_valid
_url
(url
).groups()
35 result
= self
._download
_json
('https://api.steemit.com/', video_id
, data
=json
.dumps({
37 'method': 'get_content',
38 'params': [uploader_id
, video_id
],
39 }).encode())['result']
41 metadata
= json
.loads(result
['json_metadata'])
42 video
= metadata
['video']
43 content
= video
['content']
44 info
= video
.get('info', {})
45 title
= info
.get('title') or result
['title']
50 return 'https://video.dtube.top/ipfs/' + h
53 for q
in ('240', '480', '720', '1080', ''):
54 video_url
= canonical_url(content
.get('video%shash' % q
))
57 format_id
= (q
+ 'p') if q
else 'Source'
59 self
.to_screen('%s: Checking %s video format URL' % (video_id
, format_id
))
60 self
._downloader
._opener
.open(video_url
, timeout
=5).close()
63 '%s: %s URL is invalid, skipping' % (video_id
, format_id
))
66 'format_id': format_id
,
68 'height': int_or_none(q
),
75 'description': content
.get('description'),
76 'thumbnail': canonical_url(info
.get('snaphash')),
77 'tags': content
.get('tags') or metadata
.get('tags'),
78 'duration': info
.get('duration'),
80 'timestamp': parse_iso8601(result
.get('created')),
81 'uploader_id': uploader_id
,