From: Sergey M․ Date: Sat, 21 Mar 2015 14:42:48 +0000 (+0600) Subject: [nrk:playlist] Relax video id regex and improve _VALID_URL X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=a09141548aa31db7c7d9457b10f5c84e6e32beba;p=youtube-dl.git [nrk:playlist] Relax video id regex and improve _VALID_URL --- diff --git a/youtube_dl/extractor/nrk.py b/youtube_dl/extractor/nrk.py index 1355ecea2..e91d3a248 100644 --- a/youtube_dl/extractor/nrk.py +++ b/youtube_dl/extractor/nrk.py @@ -77,17 +77,25 @@ class NRKIE(InfoExtractor): class NRKPlaylistIE(InfoExtractor): - _VALID_URL = r'http://(?:www\.)?nrk\.no/(?!video)[^/]+/(?P[^/]+)' + _VALID_URL = r'http://(?:www\.)?nrk\.no/(?!video)(?:[^/]+/)+(?P[^/]+)' - _TEST = { + _TESTS = [{ 'url': 'http://www.nrk.no/troms/gjenopplev-den-historiske-solformorkelsen-1.12270763', 'info_dict': { 'id': 'gjenopplev-den-historiske-solformorkelsen-1.12270763', 'title': 'Gjenopplev den historiske solformørkelsen', 'description': 'md5:c2df8ea3bac5654a26fc2834a542feed', }, - 'playlist_mincount': 2, - } + 'playlist_count': 2, + }, { + 'url': 'http://www.nrk.no/kultur/bok/rivertonprisen-til-karin-fossum-1.12266449', + 'info_dict': { + 'id': 'rivertonprisen-til-karin-fossum-1.12266449', + 'title': 'Rivertonprisen til Karin Fossum', + 'description': 'Første kvinne pÃ¥ 15 Ã¥r til Ã¥ vinne krimlitteraturprisen.', + }, + 'playlist_count': 5, + }] def _real_extract(self, url): playlist_id = self._match_id(url) @@ -97,7 +105,8 @@ class NRKPlaylistIE(InfoExtractor): entries = [ self.url_result('nrk:%s' % video_id, 'NRK') for video_id in re.findall( - r'class="[^"]*\brich\b[^"]*"[^>]+data-video-id="(\d+)"', webpage) + r'class="[^"]*\brich\b[^"]*"[^>]+data-video-id="([^"]+)"', + webpage) ] playlist_title = self._og_search_title(webpage)