[tvp] Expand _VALID_URL and improve naming (Closes #9602)

This commit is contained in:
Sergey M․ 2016-05-26 22:21:55 +06:00
parent 448bb5f333
commit 6f8cb24219
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D
2 changed files with 29 additions and 23 deletions

View file

@ -833,7 +833,10 @@ from .tvc import (
) )
from .tvigle import TvigleIE from .tvigle import TvigleIE
from .tvland import TVLandIE from .tvland import TVLandIE
from .tvp import TvpIE, TvpSeriesIE from .tvp import (
TVPIE,
TVPSeriesIE,
)
from .tvplay import TVPlayIE from .tvplay import TVPlayIE
from .tweakers import TweakersIE from .tweakers import TweakersIE
from .twentyfourvideo import TwentyFourVideoIE from .twentyfourvideo import TwentyFourVideoIE

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re import re
@ -6,20 +6,13 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
class TvpIE(InfoExtractor): class TVPIE(InfoExtractor):
IE_NAME = 'tvp.pl' IE_NAME = 'tvp'
_VALID_URL = r'https?://(?:vod|www)\.tvp\.pl/.*/(?P<id>\d+)$' IE_DESC = 'Telewizja Polska'
_VALID_URL = r'https?://[^/]+\.tvp\.(?:pl|info)/(?:(?!\d+/)[^/]+/)*(?P<id>\d+)'
_TESTS = [{ _TESTS = [{
'url': 'http://vod.tvp.pl/filmy-fabularne/filmy-za-darmo/ogniem-i-mieczem/wideo/odc-2/4278035', 'url': 'http://vod.tvp.pl/194536/i-seria-odc-13',
'md5': 'cdd98303338b8a7f7abab5cd14092bf2',
'info_dict': {
'id': '4278035',
'ext': 'wmv',
'title': 'Ogniem i mieczem, odc. 2',
},
}, {
'url': 'http://vod.tvp.pl/seriale/obyczajowe/czas-honoru/sezon-1-1-13/i-seria-odc-13/194536',
'md5': '8aa518c15e5cc32dfe8db400dc921fbb', 'md5': '8aa518c15e5cc32dfe8db400dc921fbb',
'info_dict': { 'info_dict': {
'id': '194536', 'id': '194536',
@ -36,12 +29,22 @@ class TvpIE(InfoExtractor):
}, },
}, { }, {
'url': 'http://vod.tvp.pl/seriale/obyczajowe/na-sygnale/sezon-2-27-/odc-39/17834272', 'url': 'http://vod.tvp.pl/seriale/obyczajowe/na-sygnale/sezon-2-27-/odc-39/17834272',
'md5': 'c3b15ed1af288131115ff17a17c19dda', 'only_matching': True,
'info_dict': { }, {
'id': '17834272', 'url': 'http://wiadomosci.tvp.pl/25169746/24052016-1200',
'ext': 'mp4', 'only_matching': True,
'title': 'Na sygnale, odc. 39', }, {
}, 'url': 'http://krakow.tvp.pl/25511623/25lecie-mck-wyjatkowe-miejsce-na-mapie-krakowa',
'only_matching': True,
}, {
'url': 'http://teleexpress.tvp.pl/25522307/wierni-wzieli-udzial-w-procesjach',
'only_matching': True,
}, {
'url': 'http://sport.tvp.pl/25522165/krychowiak-uspokaja-w-sprawie-kontuzji-dwa-tygodnie-to-maksimum',
'only_matching': True,
}, {
'url': 'http://www.tvp.info/25511919/trwa-rewolucja-wladza-zdecydowala-sie-na-pogwalcenie-konstytucji',
'only_matching': True,
}] }]
def _real_extract(self, url): def _real_extract(self, url):
@ -92,8 +95,8 @@ class TvpIE(InfoExtractor):
} }
class TvpSeriesIE(InfoExtractor): class TVPSeriesIE(InfoExtractor):
IE_NAME = 'tvp.pl:Series' IE_NAME = 'tvp:series'
_VALID_URL = r'https?://vod\.tvp\.pl/(?:[^/]+/){2}(?P<id>[^/]+)/?$' _VALID_URL = r'https?://vod\.tvp\.pl/(?:[^/]+/){2}(?P<id>[^/]+)/?$'
_TESTS = [{ _TESTS = [{
@ -127,7 +130,7 @@ class TvpSeriesIE(InfoExtractor):
videos_paths = re.findall( videos_paths = re.findall(
'(?s)class="shortTitle">.*?href="(/[^"]+)', playlist) '(?s)class="shortTitle">.*?href="(/[^"]+)', playlist)
entries = [ entries = [
self.url_result('http://vod.tvp.pl%s' % v_path, ie=TvpIE.ie_key()) self.url_result('http://vod.tvp.pl%s' % v_path, ie=TVPIE.ie_key())
for v_path in videos_paths] for v_path in videos_paths]
return { return {