diff --git a/test/test_all_urls.py b/test/test_all_urls.py index 94cbce6e8..dcce9ddb8 100644 --- a/test/test_all_urls.py +++ b/test/test_all_urls.py @@ -37,6 +37,8 @@ class TestAllURLsMatching(unittest.TestCase): assertPlaylist(u'https://www.youtube.com/playlist?list=PLwP_SiAcdui0KVebT0mU9Apz359a4ubsC') assertPlaylist(u'https://www.youtube.com/watch?v=AV6J6_AeFEQ&playnext=1&list=PL4023E734DA416012') #668 self.assertFalse('youtube:playlist' in self.matching_ies(u'PLtS2H6bU1M')) + # Top tracks + assertPlaylist('https://www.youtube.com/playlist?list=MCUS.20142101') def test_youtube_matching(self): self.assertTrue(YoutubeIE.suitable(u'PLtS2H6bU1M')) diff --git a/test/test_youtube_lists.py b/test/test_youtube_lists.py index de157f657..c9632ddf6 100644 --- a/test/test_youtube_lists.py +++ b/test/test_youtube_lists.py @@ -117,6 +117,13 @@ class TestYoutubeLists(unittest.TestCase): original_video = entries[0] self.assertEqual(original_video['id'], 'rjFaenf1T-Y') + def test_youtube_toptracks(self): + dl = FakeYDL() + ie = YoutubePlaylistIE(dl) + result = ie.extract('https://www.youtube.com/playlist?list=MCUS') + entries = result['entries'] + self.assertEqual(len(entries), 100) + def test_youtube_toplist(self): dl = FakeYDL() ie = YoutubeTopListIE(dl) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index fed2d91dc..e81366851 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -41,6 +41,7 @@ __authors__ = ( 'Chris Gahan', 'Saimadhav Heblikar', 'Mike Col', + 'Andreas Schmitz', ) __license__ = 'Public Domain' diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 02a422fe6..c0a57c73d 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -143,8 +143,10 @@ from .myvideo import MyVideoIE from .naver import NaverIE from .nba import NBAIE from .nbc import NBCNewsIE +from .ndr import NDRIE from .ndtv import NDTVIE from .newgrounds import NewgroundsIE +from .nfb import NFBIE from .nhl import NHLIE, NHLVideocenterIE from .niconico import NiconicoIE from .ninegag import NineGagIE diff --git a/youtube_dl/extractor/chilloutzone.py b/youtube_dl/extractor/chilloutzone.py index 59a188746..e9903c613 100644 --- a/youtube_dl/extractor/chilloutzone.py +++ b/youtube_dl/extractor/chilloutzone.py @@ -1,14 +1,18 @@ +from __future__ import unicode_literals + import re import base64 -import urllib import json from .common import InfoExtractor +from ..utils import ( + clean_html, + ExtractorError +) -video_container = ('.mp4', '.mkv', '.flv') class ChilloutzoneIE(InfoExtractor): - _VALID_URL = r'(?:https?://)?(?:www\.)?chilloutzone\.net/video/(?P[\w|-]+).html' + _VALID_URL = r'https?://(?:www\.)?chilloutzone\.net/video/(?P[\w|-]+)\.html' _TEST = { 'url': 'http://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html', 'md5': 'a76f3457e813ea0037e5244f509e66d1', @@ -16,6 +20,7 @@ class ChilloutzoneIE(InfoExtractor): 'id': 'enemene-meck-alle-katzen-weg', 'ext': 'mp4', 'title': 'Enemene Meck - Alle Katzen weg', + 'description': 'Ist das der Umkehrschluss des Niesenden Panda-Babys?', }, } @@ -23,71 +28,45 @@ class ChilloutzoneIE(InfoExtractor): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') - webpage_url = 'http://www.chilloutzone.net/video/' + video_id + '.html' + webpage = self._download_webpage(url, video_id) - # Log that we are starting to download the page - self.report_download_webpage(webpage_url) - webpage = self._download_webpage(webpage_url, video_id) - - # Log that we are starting to parse the page - self.report_extraction(video_id) - # Find base64 decoded file info - base64_video_info = self._html_search_regex(r'var cozVidData = "(.+?)";', webpage, u'video Data') - # decode string and find video file + base64_video_info = self._html_search_regex( + r'var cozVidData = "(.+?)";', webpage, 'video data') decoded_video_info = base64.b64decode(base64_video_info).decode("utf-8") video_info_dict = json.loads(decoded_video_info) + # get video information from dict - media_url = video_info_dict['mediaUrl'] - description = video_info_dict['description'] + video_url = video_info_dict['mediaUrl'] + description = clean_html(video_info_dict.get('description')) title = video_info_dict['title'] native_platform = video_info_dict['nativePlatform'] native_video_id = video_info_dict['nativeVideoId'] source_priority = video_info_dict['sourcePriority'] - - # Start video extraction - video_url = '' # If nativePlatform is None a fallback mechanism is used (i.e. youtube embed) - if native_platform == None: - # Look for other video urls - video_url = self._html_search_regex(r'[^/#?]+)\.html(?:$|[?#])' - IE_DESCR = 'El País' + IE_DESC = 'El País' _TEST = { 'url': 'http://blogs.elpais.com/la-voz-de-inaki/2014/02/tiempo-nuevo-recetas-viejas.html', diff --git a/youtube_dl/extractor/mooshare.py b/youtube_dl/extractor/mooshare.py index 909d21a99..f1875add5 100644 --- a/youtube_dl/extractor/mooshare.py +++ b/youtube_dl/extractor/mooshare.py @@ -61,7 +61,7 @@ class MooshareIE(InfoExtractor): } request = compat_urllib_request.Request( - 'http://mooshare.biz/8dqtk4bjbp8g', compat_urllib_parse.urlencode(download_form)) + 'http://mooshare.biz/%s' % video_id, compat_urllib_parse.urlencode(download_form)) request.add_header('Content-Type', 'application/x-www-form-urlencoded') self.to_screen('%s: Waiting for timeout' % video_id) @@ -111,4 +111,4 @@ class MooshareIE(InfoExtractor): 'thumbnail': thumbnail, 'duration': duration, 'formats': formats, - } + } \ No newline at end of file diff --git a/youtube_dl/extractor/ndr.py b/youtube_dl/extractor/ndr.py new file mode 100644 index 000000000..bf6782d7d --- /dev/null +++ b/youtube_dl/extractor/ndr.py @@ -0,0 +1,89 @@ +# encoding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ExtractorError + + +class NDRIE(InfoExtractor): + IE_NAME = 'ndr' + IE_DESC = 'NDR.de - Mediathek' + _VALID_URL = r'https?://www\.ndr\.de/.+?(?P\d+)\.html' + + _TESTS = [ + # video + { + 'url': 'http://www.ndr.de/fernsehen/sendungen/hallo_niedersachsen/media/hallonds19925.html', + 'md5': '20eba151ff165f386643dad9c1da08f7', + 'info_dict': { + 'id': '19925', + 'ext': 'mp4', + 'title': 'Hallo Niedersachsen ', + 'description': 'Bei Hallo Niedersachsen um 19:30 Uhr erfahren Sie alles, was am Tag in Niedersachsen los war.', + 'duration': 1722, + }, + }, + # audio + { + 'url': 'http://www.ndr.de/903/audio191719.html', + 'md5': '41ed601768534dd18a9ae34d84798129', + 'info_dict': { + 'id': '191719', + 'ext': 'mp3', + 'title': '"Es war schockierend"', + 'description': 'md5:ed7ff8364793545021a6355b97e95f10', + 'duration': 112, + } + } + ] + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + page = self._download_webpage(url, video_id, 'Downloading page') + + title = self._og_search_title(page) + description = self._og_search_description(page) + + mobj = re.search( + r'
(?P\d+):(?P\d+)
', + page) + duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None + + formats = [] + + mp3_url = re.search(r'''{src:'(?P