]>
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
):
12 _VALID_URL
= r
'https?://(?:www\.)?d\.tube/(?:#!/)?v/(?P<uploader_id>[0-9a-z.-]+)/(?P<id>[0-9a-z]{8})'
14 'url': 'https://d.tube/#!/v/broncnutz/x380jtr1',
15 'md5': '9f29088fa08d699a7565ee983f56a06e',
19 'title': 'Lefty 3-Rings is Back Baby!! NCAA Picks',
20 'description': 'md5:60be222088183be3a42f196f34235776',
21 'uploader_id': 'broncnutz',
22 'upload_date': '20190107',
23 'timestamp': 1546854054,
30 def _real_extract(self
, url
):
31 uploader_id
, video_id
= self
._match
_valid
_url
(url
).groups()
32 result
= self
._download
_json
('https://api.steemit.com/', video_id
, data
=json
.dumps({
34 'method': 'get_content',
35 'params': [uploader_id
, video_id
],
36 }).encode())['result']
38 metadata
= json
.loads(result
['json_metadata'])
39 video
= metadata
['video']
40 content
= video
['content']
41 info
= video
.get('info', {})
42 title
= info
.get('title') or result
['title']
47 return 'https://video.dtube.top/ipfs/' + h
50 for q
in ('240', '480', '720', '1080', ''):
51 video_url
= canonical_url(content
.get('video%shash' % q
))
54 format_id
= (q
+ 'p') if q
else 'Source'
56 self
.to_screen('%s: Checking %s video format URL' % (video_id
, format_id
))
57 self
._downloader
._opener
.open(video_url
, timeout
=5).close()
60 '%s: %s URL is invalid, skipping' % (video_id
, format_id
))
63 'format_id': format_id
,
65 'height': int_or_none(q
),
72 'description': content
.get('description'),
73 'thumbnail': canonical_url(info
.get('snaphash')),
74 'tags': content
.get('tags') or metadata
.get('tags'),
75 'duration': info
.get('duration'),
77 'timestamp': parse_iso8601(result
.get('created')),
78 'uploader_id': uploader_id
,