1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-01-27 12:35:35 +08:00

[dbtv] Relax _VALID_URL a bit

This commit is contained in:
Lodvær 2015-11-25 12:40:24 +00:00
parent 7689413e42
commit 6caccd0fb1

View File

@ -13,8 +13,8 @@ from ..utils import (
class DBTVIE(InfoExtractor):
_VALID_URL = r'http://dbtv\.no/(?P<id>[0-9]+)#(?P<display_id>.+)'
_TEST = {
_VALID_URL = r'http://(www\.)?dbtv\.no/(lazyplayer/|player/)?(?P<id>[0-9]+)(#(?P<display_id>.+))?'
_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)