2 from __future__ import unicode_literals
6 from socket import timeout
8 from .common import InfoExtractor
15 class DTubeIE(InfoExtractor):
16 _VALID_URL = r'https?://(?:www\.)?d\.tube/(?:#!/)?v/(?P<uploader_id>[0-9a-z.-]+)/(?P<id>[0-9a-z]{8})'
18 'url': 'https://d.tube/#!/v/broncnutz/x380jtr1',
19 'md5': '9f29088fa08d699a7565ee983f56a06e',
23 'title': 'Lefty 3-Rings is Back Baby!! NCAA Picks',
24 'description': 'md5:60be222088183be3a42f196f34235776',
25 'uploader_id': 'broncnutz',
26 'upload_date': '20190107',
27 'timestamp': 1546854054,
34 def _real_extract(self, url):
35 uploader_id, video_id = re.match(self._VALID_URL, url).groups()
36 result = self._download_json('https://api.steemit.com/', video_id, data=json.dumps({
38 'method': 'get_content',
39 'params': [uploader_id, video_id],
40 }).encode())['result']
42 metadata = json.loads(result['json_metadata'])
43 video = metadata['video']
44 content = video['content']
45 info = video.get('info', {})
46 title = info.get('title') or result['title']
51 return 'https://video.dtube.top/ipfs/' + h
54 for q in ('240', '480', '720', '1080', ''):
55 video_url = canonical_url(content.get('video%shash' % q))
58 format_id = (q + 'p') if q else 'Source'
60 self.to_screen('%s: Checking %s video format URL' % (video_id, format_id))
61 self._downloader._opener.open(video_url, timeout=5).close()
64 '%s: %s URL is invalid, skipping' % (video_id, format_id))
67 'format_id': format_id,
69 'height': int_or_none(q),
76 'description': content.get('description'),
77 'thumbnail': canonical_url(info.get('snaphash')),
78 'tags': content.get('tags') or metadata.get('tags'),
79 'duration': info.get('duration'),
81 'timestamp': parse_iso8601(result.get('created')),
82 'uploader_id': uploader_id,