tvnplayer:series extractor
This commit is contained in:
parent
837924dd1b
commit
33c63089d9
|
@ -1233,7 +1233,10 @@ from .tvc import (
|
|||
from .tvigle import TvigleIE
|
||||
from .tvland import TVLandIE
|
||||
from .tvn24 import TVN24IE
|
||||
from .tvnplayer import TVNPlayerIE
|
||||
from .tvnplayer import (
|
||||
TVNPlayerIE,
|
||||
TVNPlayerSeriesIE,
|
||||
)
|
||||
from .tvnet import TVNetIE
|
||||
from .tvnoe import TVNoeIE
|
||||
from .tvnow import (
|
||||
|
|
|
@ -3,13 +3,17 @@ from __future__ import unicode_literals
|
|||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
compat_str,
|
||||
int_or_none,
|
||||
parse_iso8601,
|
||||
str_or_none,
|
||||
unescapeHTML,
|
||||
ExtractorError,
|
||||
)
|
||||
|
||||
|
||||
class TVNPlayerIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://player\.pl/.+,(?P<id>[0-9]+)'
|
||||
_VALID_URL = r'https?://player\.pl/(?:programy|seriale)-online/[^/,]+,([0-9]+)/(?:[^/,]+,){2}(?P<id>\d+)'
|
||||
_TESTS = [{
|
||||
'url': 'https://player.pl/seriale-online/kasia-i-tomek-odcinki,1/odcinek-1,S01E01,1',
|
||||
'info_dict': {
|
||||
|
@ -27,6 +31,7 @@ class TVNPlayerIE(InfoExtractor):
|
|||
'age_limit': 12,
|
||||
}
|
||||
}]
|
||||
IE_NAME = 'tvnplayer'
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
|
@ -54,3 +59,85 @@ class TVNPlayerIE(InfoExtractor):
|
|||
'season_number': int_or_none(res["item"]["season"]),
|
||||
'age_limit': int_or_none(res["item"]["rating"])
|
||||
}
|
||||
|
||||
|
||||
class TVNPlayerSeriesIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://player\.pl/(?:programy|seriale)-online/[^/,]+,(?P<id>[0-9]+)/?(?:\?.+)?(?:#.+)?$'
|
||||
_TESTS = [{
|
||||
'url': 'https://player.pl/seriale-online/brzydula-odcinki,52',
|
||||
'info_dict': {
|
||||
'id': '55359',
|
||||
'title': 'Brzydula',
|
||||
'age_limit': 12,
|
||||
},
|
||||
'playlist_mincount': 290,
|
||||
'expected_warnings': [
|
||||
'Some of the videos are not available yet, you may want to know about the --ignore-errors option.',
|
||||
'Some of the videos are behind the paywall for now, you may want to know about the --ignore-errors option.',
|
||||
],
|
||||
}]
|
||||
IE_NAME = 'tvnplayer:series'
|
||||
|
||||
def _real_extract(self, url):
|
||||
series_id = self._match_id(url)
|
||||
|
||||
internal_id = self._download_json(
|
||||
'https://player.pl/playerapi/item/translate?programId=%s&4K=true&platform=BROWSER' % series_id,
|
||||
series_id, 'Downloading internal series ID')
|
||||
if 'id' not in internal_id:
|
||||
raise ExtractorError('Unable to get the internal series ID: %s' % internal_id.get('code'))
|
||||
internal_id = compat_str(internal_id['id'])
|
||||
|
||||
series_meta = self._download_json(
|
||||
'https://player.pl/playerapi/product/vod/serial/%s?4K=true&platform=BROWSER' % internal_id,
|
||||
internal_id, 'Downloading internal series ID')
|
||||
|
||||
season_list = self._download_json(
|
||||
'https://player.pl/playerapi/product/vod/serial/%s/season/list?4K=true&platform=BROWSER' % internal_id,
|
||||
internal_id, 'Downloading season list')
|
||||
|
||||
entries = []
|
||||
prapremiere_warning = False
|
||||
paywall_warning = False
|
||||
for season in season_list:
|
||||
season_id = compat_str(season['id'])
|
||||
season_episodes = self._download_json(
|
||||
'https://player.pl/playerapi/product/vod/serial/%s/season/%s/episode/list?4K=true&platform=BROWSER' % (internal_id, season_id),
|
||||
season_id, 'Downloading season %s episode list' % season['display'])
|
||||
for episode in season_episodes:
|
||||
entries.append({
|
||||
'_type': 'url_transparent',
|
||||
'url': episode['shareUrl'],
|
||||
'ie_key': 'TVNPlayer',
|
||||
'id': str_or_none(episode['id']),
|
||||
'title': episode['title'],
|
||||
'description': unescapeHTML(episode.get('lead')),
|
||||
'timestamp': parse_iso8601(episode.get('since')),
|
||||
'age_limit': episode.get('rating'),
|
||||
'series': series_meta['title'],
|
||||
'season': season['title'],
|
||||
'season_number': season['number'],
|
||||
'season_id': season['display'],
|
||||
'episode': episode['title'],
|
||||
'episode_number': episode['episode'],
|
||||
})
|
||||
if not prapremiere_warning:
|
||||
if any(schedule['type'] == 'SOON' and schedule['active'] is True
|
||||
for schedule in episode['displaySchedules']):
|
||||
prapremiere_warning = True
|
||||
if not paywall_warning and episode.get('payable') is True:
|
||||
paywall_warning = True
|
||||
|
||||
if prapremiere_warning:
|
||||
self.report_warning('Some of the videos are not available yet, you may want to know about the --ignore-errors option.')
|
||||
if paywall_warning:
|
||||
self.report_warning('Some of the videos are behind the paywall for now, you may want to know about the --ignore-errors option.')
|
||||
|
||||
return {
|
||||
'_type': 'playlist',
|
||||
'id': internal_id,
|
||||
'title': series_meta['title'],
|
||||
'series': series_meta['title'],
|
||||
'age_limit': series_meta.get('rating'),
|
||||
'entries': entries,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue