From 6caccd0fb17aa4ef088ce80042da8eb8065bc692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lodv=C3=A6r?= Date: Wed, 25 Nov 2015 12:40:24 +0000 Subject: [PATCH] [dbtv] Relax _VALID_URL a bit --- youtube_dl/extractor/dbtv.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/dbtv.py b/youtube_dl/extractor/dbtv.py index 212217625..5649bee74 100644 --- a/youtube_dl/extractor/dbtv.py +++ b/youtube_dl/extractor/dbtv.py @@ -13,8 +13,8 @@ from ..utils import ( class DBTVIE(InfoExtractor): - _VALID_URL = r'http://dbtv\.no/(?P[0-9]+)#(?P.+)' - _TEST = { + _VALID_URL = r'http://(www\.)?dbtv\.no/(lazyplayer/|player/)?(?P[0-9]+)(#(?P.+))?' + _TESTS = [{ 'url': 'http://dbtv.no/3649835190001#Skulle_teste_ut_fornøyelsespark,_men_kollegaen_var_bare_opptatt_av_bikinikroppen', 'md5': 'b89953ed25dacb6edb3ef6c6f430f8bc', 'info_dict': { @@ -30,12 +30,28 @@ class DBTVIE(InfoExtractor): 'view_count': int, 'categories': list, } - } + }, { + 'url': 'http://www.dbtv.no/lazyplayer/4631135248001', + 'md5': 'f885f7dbdf85d89cc7c8cc0a552c93a1', + 'info_dict': { + 'id': '44885', + 'display_id': 'dbtv_4631135248001', + 'ext': 'mp4', + 'title': 'Det norske mottakssystemet i krise ', + 'description': 'md5:6355484d8611449e2df801b494699007', + 'thumbnail': 're:https?://.*\.jpg$', + 'timestamp': 1448448563.099, + 'upload_date': '20151125', + 'duration': 98.667, + 'view_count': int, + 'categories': list, + } + }] def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') - display_id = mobj.group('display_id') + display_id = mobj.group('display_id') or "dbtv_" + video_id data = self._download_json( 'http://api.dbtv.no/discovery/%s' % video_id, display_id)