From 60526d6bcb33d9db76a7df85f89b08ea4ee9a038 Mon Sep 17 00:00:00 2001 From: Naglis Jonaitis Date: Tue, 11 Nov 2014 16:23:06 +0200 Subject: [PATCH] [wrzuta] Fix audio extension lookup (Closes #4156) Also, replace deleted test case --- youtube_dl/extractor/wrzuta.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/youtube_dl/extractor/wrzuta.py b/youtube_dl/extractor/wrzuta.py index 41756784a..1735ea20c 100644 --- a/youtube_dl/extractor/wrzuta.py +++ b/youtube_dl/extractor/wrzuta.py @@ -27,15 +27,15 @@ class WrzutaIE(InfoExtractor): 'description': 'md5:7fb5ef3c21c5893375fda51d9b15d9cd', }, }, { - 'url': 'http://w729.wrzuta.pl/audio/9oXJqdcndqv/david_guetta_amp_showtek_ft._vassy_-_bad', - 'md5': '1e546a18e1c22ac6e9adce17b8961ff5', + 'url': 'http://jolka85.wrzuta.pl/audio/063jOPX5ue2/liber_natalia_szroeder_-_teraz_ty', + 'md5': 'bc78077859bea7bcfe4295d7d7fc9025', 'info_dict': { - 'id': '9oXJqdcndqv', + 'id': '063jOPX5ue2', 'ext': 'ogg', - 'title': 'David Guetta & Showtek ft. Vassy - Bad', - 'duration': 270, - 'uploader_id': 'w729', - 'description': 'md5:4628f01c666bbaaecefa83476cfa794a', + 'title': 'Liber & Natalia Szroeder - Teraz Ty', + 'duration': 203, + 'uploader_id': 'jolka85', + 'description': 'md5:2d2b6340f9188c8c4cd891580e481096', }, }] @@ -49,16 +49,17 @@ def _real_extract(self, url): quality = qualities(['SD', 'MQ', 'HQ', 'HD']) - audio_table = {'flv': 'mp3', 'webm': 'ogg', 'mp3': 'mp3'} + audio_table = {'flv': 'mp3', 'webm': 'ogg'} embedpage = self._download_json('http://www.wrzuta.pl/npp/embed/%s/%s' % (uploader, video_id), video_id) formats = [] for media in embedpage['url']: + fmt = media['type'].split('@')[0] if typ == 'audio': - ext = audio_table[media['type'].split('@')[0]] + ext = audio_table.get(fmt, fmt) else: - ext = media['type'].split('@')[0] + ext = fmt formats.append({ 'format_id': '%s_%s' % (ext, media['quality'].lower()),