From 74f67372b7789c15ccdec04d1d5147fa340c7ec0 Mon Sep 17 00:00:00 2001 From: flatt3rn Date: Mon, 2 Jan 2017 21:25:54 +0100 Subject: [PATCH 1/3] [UniversalMusicService] Added new Extractor --- youtube_dl/extractor/universalmusicservice.py | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 youtube_dl/extractor/universalmusicservice.py diff --git a/youtube_dl/extractor/universalmusicservice.py b/youtube_dl/extractor/universalmusicservice.py new file mode 100644 index 000000000..7c6443983 --- /dev/null +++ b/youtube_dl/extractor/universalmusicservice.py @@ -0,0 +1,37 @@ +# coding: utf-8 +from __future__ import unicode_literals +from .common import InfoExtractor +import base64 + +class UniversalMusicServiceIE(InfoExtractor): + _VALID_URL = r'https?:\/\/(?:www\.)?universal-music.de\/.+video:(?P[0-9]+)\/' + _TEST = { + 'url': 'http://www.universal-music.de/sido/videos/detail/video:373201/astronaut', + 'md5': 'f32cf902b8ab711bd2e5a9baac84af84', + 'info_dict': { + 'id': '373201', + 'ext': 'mp4', + 'title': 'Astronaut' + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + video_url = "http://mediadelivery.universal-music-services.de/vod/mp4:autofill/storage/" + video_id[0:1] + "/" + video_id[1:2] + "/" + video_id[2:3] + "/" + video_id[3:4] + "/" + video_id[4:5] + "/" + video_id[5:6] + "/content/836/file/playlist.m3u8" + #video_url = "http://mediadelivery.universal-music-services.de/vod/mp4:autofill/storage/" + video_id[0:1] + "/" + video_id[1:2] + "/" + video_id[2:3] + "/" + video_id[3:4] + "/" + video_id[4:5] + "/" + video_id[5:6] + "/content/686/file/playlist.m3u8" + + webpage = self._download_webpage(url, video_id) + title = self._html_search_regex(r'.+ \| (.+) \| .+<\/title>', webpage, 'title') + album = self._html_search_regex(r'class="product-banner-text1">(.+)<\/p>', webpage, 'album') + + return { + 'id': video_id, + 'title': title, + 'url': video_url, + 'description': self._og_search_description(webpage), + 'thumbnail': self._og_search_thumbnail(webpage, default=None), + 'album': album, + 'ext': 'mp4' + } + + From 92803c6c0139ceb07a484e60532171e8dd19401b Mon Sep 17 00:00:00 2001 From: flatt3rn <gj-sec@web.de> Date: Mon, 2 Jan 2017 21:27:46 +0100 Subject: [PATCH 2/3] [UniversalMusicService] Added to extractors.py --- youtube_dl/extractor/extractors.py | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 811db6219..c3adfb5ed 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -1027,6 +1027,7 @@ from .udn import UDNEmbedIE from .uktvplay import UKTVPlayIE from .digiteka import DigitekaIE from .unistra import UnistraIE +from .universalmusicservice import UniversalMusicServiceIE from .uol import UOLIE from .uplynk import ( UplynkIE, From b6a91ea7509b5a0905adacf6c7d2356c4e947fac Mon Sep 17 00:00:00 2001 From: flatt3rn <gj-sec@web.de> Date: Sat, 7 Jan 2017 15:15:26 +0100 Subject: [PATCH 3/3] Error Prevention and Different Qualitys Added some error preventions and an autoselection for the best quality, thats avaible --- youtube_dl/extractor/universalmusicservice.py | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/universalmusicservice.py b/youtube_dl/extractor/universalmusicservice.py index 7c6443983..c13a5f1b2 100644 --- a/youtube_dl/extractor/universalmusicservice.py +++ b/youtube_dl/extractor/universalmusicservice.py @@ -17,13 +17,34 @@ class UniversalMusicServiceIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - video_url = "http://mediadelivery.universal-music-services.de/vod/mp4:autofill/storage/" + video_id[0:1] + "/" + video_id[1:2] + "/" + video_id[2:3] + "/" + video_id[3:4] + "/" + video_id[4:5] + "/" + video_id[5:6] + "/content/836/file/playlist.m3u8" - #video_url = "http://mediadelivery.universal-music-services.de/vod/mp4:autofill/storage/" + video_id[0:1] + "/" + video_id[1:2] + "/" + video_id[2:3] + "/" + video_id[3:4] + "/" + video_id[4:5] + "/" + video_id[5:6] + "/content/686/file/playlist.m3u8" webpage = self._download_webpage(url, video_id) + if " <p>Dieser Inhalt ist nicht (mehr) verfügbar.</p>" in webpage: + self.to_screen("ERROR: Webpage not found") + sys.exit() title = self._html_search_regex(r'<title>.+ \| (.+) \| .+<\/title>', webpage, 'title') album = self._html_search_regex(r'class="product-banner-text1">(.+)<\/p>', webpage, 'album') + if len(title) == 0: + self.to_screen("Title not found") + title = "Unknown" + if len(album) == 0: + self.to_screen("Album not found")) + album = "Unknown" + + qualitys = ["940","836",867] + #836: 1024x576 + #940: 1920x1080 + #867: 483x272 + for quality in qualitys: + video_url = "http://mediadelivery.universal-music-services.de/vod/mp4:autofill/storage/" + video_id[0:1] + "/" + video_id[1:2] + "/" + video_id[2:3] + "/" + video_id[3:4] + "/" + video_id[4:5] + "/" + video_id[5:6] + "/content/" + quality + "/file/playlist.m3u8" + webpage = self._download_webpage(video_url, video_id) + if "RESOLUTION=" in webpage: + break + if len(video_url) == 0: + self.to_screen("ERROR: No Stream found") + sys.exit() + return { 'id': video_id, 'title': title,