1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-29 19:47:54 +01:00

[DTube] Fix code styling

Signed-off-by: Epecb <788135@gmail.com>
This commit is contained in:
Epecb 2019-10-29 22:50:53 +03:00
parent f7a4fc0e21
commit 3f452f3675
No known key found for this signature in database
GPG Key ID: BD338715F6FE594B

View File

@ -56,20 +56,21 @@ class DTubeIE(InfoExtractor):
'uploader': 'Jeronimo Rubio', 'uploader': 'Jeronimo Rubio',
'uploader_id': 'UCbbG-SIMdWSW02RYKJucddw', 'uploader_id': 'UCbbG-SIMdWSW02RYKJucddw',
}, },
} }]
]
def _real_extract(self, url): def _real_extract(self, url):
DTube_api = 'https://avalon.d.tube/content/'
uploader_id, video_id = re.match(self._VALID_URL, url).groups() uploader_id, video_id = re.match(self._VALID_URL, url).groups()
result = self._download_json(DTube_api + uploader_id + '/' + video_id, video_id) result = self._download_json(
'https://avalon.d.tube/content/' + uploader_id + '/' + video_id,
video_id)
metadata = result.get('json') metadata = result.get('json')
if metadata.get('providerName') != "IPFS": if metadata.get('providerName') != 'IPFS':
video_url = metadata.get('url') video_url = metadata.get('url')
self.to_screen('%s : video format URL %s' % (video_url, metadata.get('providerName'))) self.to_screen('%s : video format URL %s' % (
video_url, metadata.get('providerName')))
return self.url_result(video_url) return self.url_result(video_url)
def canonical_url(h): def canonical_url(h):
@ -79,7 +80,8 @@ class DTubeIE(InfoExtractor):
formats = [] formats = []
for q in ('240', '480', '720', '1080', ''): for q in ('240', '480', '720', '1080', ''):
video_url = canonical_url(metadata.get('ipfs').get('video%shash' % q)) video_url = canonical_url(
metadata.get('ipfs').get('video%shash' % q))
if not video_url: if not video_url:
continue continue
format_id = (q + 'p') if q else 'Source' format_id = (q + 'p') if q else 'Source'