mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-01-10 05:20:09 +09:00
adding https://commons.wikimedia.org to youtube-dl
This commit is contained in:
parent
ecc770b99e
commit
e0dcf1db42
@ -32,12 +32,14 @@ class WikimediaIE(InfoExtractor):
|
|||||||
|
|
||||||
subtitle_url = f'https://commons.wikimedia.org/w/api.php?' \
|
subtitle_url = f'https://commons.wikimedia.org/w/api.php?' \
|
||||||
f'action=timedtext&lang=nl&title=File%3A{urllib.parse.quote(video_id)}&trackformat=srt'
|
f'action=timedtext&lang=nl&title=File%3A{urllib.parse.quote(video_id)}&trackformat=srt'
|
||||||
with open(video_id + '.srt', 'w+', encoding='utf') as f:
|
|
||||||
subtitles = requests.post(subtitle_url).text
|
subtitles = requests.post(subtitle_url).text
|
||||||
if 'timedtext-notfound' not in subtitles:
|
if 'timedtext-notfound' not in subtitles:
|
||||||
|
with open(video_id + '.srt', 'w+', encoding='utf') as f:
|
||||||
f.write(subtitles)
|
f.write(subtitles)
|
||||||
else:
|
else:
|
||||||
print("subtitles not found")
|
print("subtitles not found")
|
||||||
|
|
||||||
resp['url'] = video_url
|
resp['url'] = video_url
|
||||||
resp['ext'] = 'webm'
|
resp['ext'] = 'webm'
|
||||||
resp['id'] = video_id
|
resp['id'] = video_id
|
||||||
|
Loading…
Reference in New Issue
Block a user