From a6745124f99f5a93e22fbda5d169bcf4e94eed98 Mon Sep 17 00:00:00 2001 From: Rabin Vincent Date: Wed, 4 Jan 2017 21:20:15 +0100 Subject: [PATCH 1/2] [downloader/external] Support MP3 hls in FFmpegFD FFmpegFD forces mpegts or mp4 for m3u8 streams, but if the stream is MP3 we should keep use that format. --- youtube_dl/downloader/external.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py index 5d3e5d8d3..b33982631 100644 --- a/youtube_dl/downloader/external.py +++ b/youtube_dl/downloader/external.py @@ -260,7 +260,7 @@ class FFmpegFD(ExternalFD): args += ['-rtmp_live', 'live'] args += ['-i', url, '-c', 'copy'] - if protocol in ('m3u8', 'm3u8_native'): + if protocol in ('m3u8', 'm3u8_native') and info_dict.get('ext') != 'mp3': if self.params.get('hls_use_mpegts', False) or tmpfilename == '-': args += ['-f', 'mpegts'] else: From 3d315e6c7a812bd7071f7bc0fea8bd4770a97387 Mon Sep 17 00:00:00 2001 From: Rabin Vincent Date: Wed, 4 Jan 2017 21:24:05 +0100 Subject: [PATCH 2/2] [elib] Add extractor --- youtube_dl/extractor/elib.py | 31 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 2 files changed, 32 insertions(+) create mode 100644 youtube_dl/extractor/elib.py diff --git a/youtube_dl/extractor/elib.py b/youtube_dl/extractor/elib.py new file mode 100644 index 000000000..2ffeb40a4 --- /dev/null +++ b/youtube_dl/extractor/elib.py @@ -0,0 +1,31 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import clean_html + + +class ElibIE(InfoExtractor): + _VALID_URL = r'https?://delivery.*\.elib\.se/Library/(?P[^/#?]+)' + + _TEST = { + # Fake ID, real IDs are loan-specific + 'url': 'https://delivery-32.elib.se/Library/123a4d5a-1e3a-2412-84ae-4a36134e0ac1', + 'only_matching': True, + } + + def _real_extract(self, url): + video_id = self._match_id(url) + data = self._download_json( + 'https://webservices.elib.se/librarystreaming/v1.0/streamdata/' + video_id, + video_id, query={'format': 'json'}) + + return { + 'id': video_id, + 'title': data['product']['title'], + 'url': data['streamUri'], + 'ext': 'mp3', + 'vcodec': 'none', + 'description': clean_html(data['product'].get('description')), + 'thumbnail': data['product'].get('coverImage'), + } diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 3017bf56c..a48410987 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -259,6 +259,7 @@ from .ehow import EHowIE from .eighttracks import EightTracksIE from .einthusan import EinthusanIE from .eitb import EitbIE +from .elib import ElibIE from .ellentv import ( EllenTVIE, EllenTVClipsIE,