]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/dtube.py
2 from socket
import timeout
4 from .common
import InfoExtractor
11 class DTubeIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?d\.tube/(?:#!/)?v/(?P<uploader_id>[0-9a-z.-]+)/(?P<id>[0-9a-z]{8})'
15 'url': 'https://d.tube/#!/v/broncnutz/x380jtr1',
16 'md5': '9f29088fa08d699a7565ee983f56a06e',
20 'title': 'Lefty 3-Rings is Back Baby!! NCAA Picks',
21 'description': 'md5:60be222088183be3a42f196f34235776',
22 'uploader_id': 'broncnutz',
23 'upload_date': '20190107',
24 'timestamp': 1546854054,
31 def _real_extract(self
, url
):
32 uploader_id
, video_id
= self
._match
_valid
_url
(url
).groups()
33 result
= self
._download
_json
('https://api.steemit.com/', video_id
, data
=json
.dumps({
35 'method': 'get_content',
36 'params': [uploader_id
, video_id
],
37 }).encode())['result']
39 metadata
= json
.loads(result
['json_metadata'])
40 video
= metadata
['video']
41 content
= video
['content']
42 info
= video
.get('info', {})
43 title
= info
.get('title') or result
['title']
48 return 'https://video.dtube.top/ipfs/' + h
51 for q
in ('240', '480', '720', '1080', ''):
52 video_url
= canonical_url(content
.get('video%shash' % q
))
55 format_id
= (q
+ 'p') if q
else 'Source'
57 self
.to_screen('%s: Checking %s video format URL' % (video_id
, format_id
))
58 self
._downloader
._opener
.open(video_url
, timeout
=5).close()
61 '%s: %s URL is invalid, skipping' % (video_id
, format_id
))
64 'format_id': format_id
,
66 'height': int_or_none(q
),
73 'description': content
.get('description'),
74 'thumbnail': canonical_url(info
.get('snaphash')),
75 'tags': content
.get('tags') or metadata
.get('tags'),
76 'duration': info
.get('duration'),
78 'timestamp': parse_iso8601(result
.get('created')),
79 'uploader_id': uploader_id
,