-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tvnow] bugfix & download whole serie #15837
Changes from 5 commits
e34e398
944ccd8
1790c32
c8ab16c
e02ed37
c796466
1eb2642
826b775
47dc6df
07fc010
1b203ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1134,6 +1134,7 @@ | |
from .tvnow import ( | ||
TVNowIE, | ||
TVNowListIE, | ||
TVNowListChannelIE, | ||
) | ||
from .tvp import ( | ||
TVPEmbedIE, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,24 @@ def _call_api(self, path, video_id, query): | |
'https://api.tvnow.de/v3/' + path, | ||
video_id, query=query) | ||
|
||
def _extend_query(self, show, season, video=None): | ||
fields = [] | ||
fields.extend(show) | ||
fields.extend('formatTabs.%s' % field for field in season) | ||
if video: | ||
fields.extend( | ||
'formatTabs.formatTabPages.container.movies.%s' % field | ||
for field in video) | ||
|
||
return fields | ||
|
||
def _tvnow_list_info(self, list_id, show_id, fields): | ||
return self._call_api( | ||
'formats/seo', list_id, query={ | ||
'fields': ','.join(fields), | ||
'name': show_id + '.php' | ||
}) | ||
|
||
def _extract_video(self, info, display_id): | ||
video_id = compat_str(info['id']) | ||
title = info['title'] | ||
|
@@ -152,18 +170,8 @@ class TVNowListIE(TVNowBaseIE): | |
def _real_extract(self, url): | ||
base_url, show_id, season_id = re.match(self._VALID_URL, url).groups() | ||
|
||
fields = [] | ||
fields.extend(self._SHOW_FIELDS) | ||
fields.extend('formatTabs.%s' % field for field in self._SEASON_FIELDS) | ||
fields.extend( | ||
'formatTabs.formatTabPages.container.movies.%s' % field | ||
for field in self._VIDEO_FIELDS) | ||
|
||
list_info = self._call_api( | ||
'formats/seo', season_id, query={ | ||
'fields': ','.join(fields), | ||
'name': show_id + '.php' | ||
}) | ||
fields = self._extend_query(self._SHOW_FIELDS, self._SEASON_FIELDS, self._VIDEO_FIELDS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code duplication 173, 213. There is no sense to extract fields explicitly. |
||
list_info = self._tvnow_list_info(season_id, show_id, fields) | ||
|
||
season = next( | ||
season for season in list_info['formatTabs']['items'] | ||
|
@@ -178,7 +186,40 @@ def _real_extract(self, url): | |
if not seo_url: | ||
continue | ||
entries.append(self.url_result( | ||
base_url + seo_url + '/player', 'TVNow', info.get('id'))) | ||
base_url + seo_url + '/player', 'TVNow', str(info.get('id')))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing changed. |
||
|
||
return self.playlist_result( | ||
entries, compat_str(season.get('id') or season_id), title) | ||
|
||
|
||
class TVNowListChannelIE(TVNowBaseIE): | ||
_VALID_URL = r'(?P<base_url>https?://(?:www\.)?tvnow\.(?:de|at|ch)/(?:rtl(?:2|plus)?|nitro|superrtl|ntv|vox)/(?P<show_id>[^/]+)$)' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've already pointed out: no trailing |
||
|
||
_SHOW_FIELDS = ('id', 'title', ) | ||
_SEASON_FIELDS = ('id', 'headline', 'seoheadline', ) | ||
|
||
_TESTS = [{ | ||
'url': 'https://www.tvnow.at/vox/ab-ins-beet', | ||
'info_dict': { | ||
'id': 172, | ||
'title': 'Ab ins Beet!', | ||
}, | ||
'playlist_mincount': 1, | ||
}] | ||
|
||
def _real_extract(self, url): | ||
base_url, show_id = re.match(self._VALID_URL, url).groups() | ||
|
||
fields = self._extend_query(self._SHOW_FIELDS, self._SEASON_FIELDS, self._VIDEO_FIELDS) | ||
list_info = self._tvnow_list_info(show_id, show_id, fields) | ||
|
||
entries = [] | ||
for season_info in list_info['formatTabs']['items']: | ||
season_url = season_info.get('seoheadline') | ||
if not season_url: | ||
continue | ||
entries.append(self.url_result( | ||
base_url + "/list/" + season_url, 'TVNowList', compat_str(season_info.get('id')), season_info.get('headline'))) | ||
|
||
return self.playlist_result( | ||
entries, list_info['id'], list_info['title']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Playlist id and title should not be fatal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not used in single video extractor thus should not be here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is fixed