1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-09-21 01:58:45 +02:00

[Amara] Prefer Youtube, Vimeo, Generic, in that order

This commit is contained in:
Joost Verdoorn 2019-05-21 12:58:29 +02:00 committed by Joost Verdoorn
parent df6d4f30cd
commit 3f81122b7f

View File

@ -262,17 +262,16 @@ class AmaraIE(InfoExtractor):
video_id = self._match_id(url) video_id = self._match_id(url)
meta = self._download_json('https://amara.org/api/videos/%s/?extra=player_urls&format=json' % video_id, video_id) meta = self._download_json('https://amara.org/api/videos/%s/?extra=player_urls&format=json' % video_id, video_id)
video_type = meta.get('video_type') video_urls = meta.get('all_urls')
video_url = meta.get('all_urls')[0] youtube_urls = filter(YoutubeIE.suitable, video_urls)
vimeo_urls = filter(VimeoIE.suitable, video_urls)
if video_type == 'Y': if len(youtube_urls) > 0:
IE = YoutubeIE ie_info = YoutubeIE(downloader=self._downloader).extract(youtube_urls[0])
elif video_type == 'V': elif len(vimeo_urls) > 0:
IE = VimeoIE ie_info = VimeoIE(downloader=self._downloader).extract(vimeo_urls[0])
else: else:
IE = GenericIE ie_info = GenericIE(downloader=self._downloader).extract(video_urls[0])
ie_info = IE(downloader=self._downloader).extract(video_url)
subtitles = ie_info.get('subtitles', {}).copy() subtitles = ie_info.get('subtitles', {}).copy()
subtitles.update(dict(map(lambda language: [ subtitles.update(dict(map(lambda language: [