From 995029a142cd0046ee43b583f2d09fc3d5fa321a Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Mon, 2 Feb 2015 23:38:35 +0100 Subject: [PATCH] [nerdist] Add new extractor (Fixes #4851) --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/common.py | 7 ++- youtube_dl/extractor/nerdist.py | 80 ++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 youtube_dl/extractor/nerdist.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 205bd4338..5dcb14feb 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -285,6 +285,7 @@ from .ndr import NDRIE from .ndtv import NDTVIE from .netzkino import NetzkinoIE from .nerdcubed import NerdCubedFeedIE +from .nerdist import NerdistIE from .newgrounds import NewgroundsIE from .newstube import NewstubeIE from .nextmedia import ( diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 8b4ef3f09..9e517e3ac 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -860,10 +860,13 @@ class InfoExtractor(object): return formats # TODO: improve extraction - def _extract_smil_formats(self, smil_url, video_id): + def _extract_smil_formats(self, smil_url, video_id, fatal=True): smil = self._download_xml( smil_url, video_id, 'Downloading SMIL file', - 'Unable to download SMIL file') + 'Unable to download SMIL file', fatal=fatal) + if smil is False: + assert not fatal + return [] base = smil.find('./head/meta').get('base') diff --git a/youtube_dl/extractor/nerdist.py b/youtube_dl/extractor/nerdist.py new file mode 100644 index 000000000..c6dc34be4 --- /dev/null +++ b/youtube_dl/extractor/nerdist.py @@ -0,0 +1,80 @@ +# encoding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +from ..utils import ( + determine_ext, + parse_iso8601, + xpath_text, +) + + +class NerdistIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?nerdist\.com/vepisode/(?P[^/?#]+)' + _TEST = { + 'url': 'http://www.nerdist.com/vepisode/exclusive-which-dc-characters-w', + 'md5': '3698ed582931b90d9e81e02e26e89f23', + 'info_dict': { + 'display_id': 'exclusive-which-dc-characters-w', + 'id': 'RPHpvJyr', + 'ext': 'mp4', + 'title': 'Your TEEN TITANS Revealed! Who\'s on the show?', + 'thumbnail': 're:^https?://.*/thumbs/.*\.jpg$', + 'description': 'Exclusive: Find out which DC Comics superheroes will star in TEEN TITANS Live-Action TV Show on Nerdist News with Jessica Chobot!', + 'uploader': 'Eric Diaz', + 'upload_date': '20150202', + 'timestamp': 1422892808, + } + } + + def _real_extract(self, url): + display_id = self._match_id(url) + webpage = self._download_webpage(url, display_id) + + video_id = self._search_regex( + r'''(?x)