1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-11 00:07:19 +08:00
Renamed ABCIViewShowIE to ABCIViewSeriesIE to match this new behaviour.
This commit is contained in:
David Hood 2019-02-27 22:52:56 +11:00
parent cd6f026f8b
commit 78e9d5e873
2 changed files with 88 additions and 22 deletions

View File

@ -192,48 +192,114 @@ class ABCIViewIE(InfoExtractor):
} }
class ABCIViewShowIE(ABCIViewIE): class ABCIViewSeriesIE(ABCIViewIE):
IE_NAME = 'abc.net.au:iview:show' IE_NAME = 'abc.net.au:iview:show'
_VALID_URL = r'https?://iview\.abc\.net\.au/show/(?P<id>[^/?#]+)' _VALID_URL = r'https?://iview\.abc\.net\.au/show/(?P<id>[^/?#]+)'
# ABC iview programs are normally available for 14 days only.
_TESTS = [{ _TESTS = [{
'url': 'https://iview.abc.net.au/show/play-school-celebrity-covers',
'info_dict': {
'title': "Play School Celebrity Covers",
'description': 'md5:5cf7b4e466b72ee1b930fc95b2a80ed7',
'uploader_id': 'abc4kids',
},
'playlist_count': 31
},
{
'url': 'https://iview.abc.net.au/show/play-school-story-time', 'url': 'https://iview.abc.net.au/show/play-school-story-time',
'info_dict': { 'info_dict': {
'title': "Play School Story Time", 'title': "Play School Story Time",
'description': 'md5:384ca6867e84e3aa2f5ef48e1b982e83', 'description': 'md5:2763b35f418d334d72e3d7f7fc7afb82',
'uploader_id': 'abc4kids', 'uploader_id': 'abc4kids',
}, },
'playlist_count': 17 'playlist_count': 24
},
{
'url': 'https://iview.abc.net.au/show/play-school-story-time-languages',
'info_dict': {
'title': "Play School Story Time: Languages",
'description': 'md5:cca001fadcf1cb1508a9301c4fb0343a',
'uploader_id': 'abc4kids',
},
'playlist_count': 5
},
{
'url': 'https://iview.abc.net.au/show/big-teds-big-adventure',
'info_dict': {
'title': "Big Ted's Big Adventure",
'description': 'md5:77f30f44f632f0f4d312e3b9af1869f6',
'uploader_id': 'abc4kids',
},
'playlist_count': 20
},
{
'url': 'https://iview.abc.net.au/show/humptys-big-adventure',
'info_dict': {
'title': "Humpty's Big Adventure",
'description': 'md5:65c4335e1576ec92426f5d05a52c04f6',
'uploader_id': 'abc4kids',
},
'playlist_count': 16
},
{
'url': 'https://iview.abc.net.au/show/jemimas-big-adventure',
'info_dict': {
'title': "Jemima's Big Adventure",
'description': 'md5:be79641bb70f329ca40b924c25a7f293',
'uploader_id': 'abc4kids',
},
'playlist_count': 10
},
{
'url': 'https://iview.abc.net.au/show/joeys-big-adventure',
'info_dict': {
'title': "Joey's Big Adventure",
'description': 'md5:e3529b28bc25de54bceb96f0f4dbee7a',
'uploader_id': 'abc4kids',
},
'playlist_count': 13
},
{
'url': 'https://iview.abc.net.au/show/little-teds-big-adventure',
'info_dict': {
'title': "Little Ted's Big Adventure",
'description': 'md5:8d064998070bfafeec142547ab48982c',
'uploader_id': 'abc4kids',
},
'playlist_count': 20
},
{
'url': 'https://iview.abc.net.au/show/maurices-big-adventure',
'info_dict': {
'title': "Maurice's Big Adventure",
'description': 'md5:a41d7b9b0c87ef610c117a679f3efd5e',
'uploader_id': 'abc4kids',
},
'playlist_count': 12
}] }]
def _real_extract(self, url): def _real_extract(self, url):
show_id = self._match_id(url) series_id = self._match_id(url)
# This ends up getting the video_params for the initial entry series_params = self._download_json(
# However just taking the next episode data keeps the Downloading JSON metadata, webpage, m3u8 information 'https://iview.abc.net.au/api/series/' + series_id, series_id)
# more consistent.
show_params = self._download_json(
'https://iview.abc.net.au/api/programs/' + show_id, show_id)
next_href = show_params.get('nextEpisode').get('href') # Sometimes the episodes are listed in reverse order, with the most recently uploaded ones first.
seen_hrefs = set() # This is normally for time-limited series. Others appear oldest to newest
episodes = series_params.get('episodes')
entries = [] entries = []
while next_href and next_href not in seen_hrefs: for episode in episodes:
seen_hrefs.add(next_href) href = episode.get('href')
video_id = episode.get('episodeHouseNumber')
video_id = next_href.rsplit('/', 1)[-1]
video_params = self._download_json( video_params = self._download_json(
'https://iview.abc.net.au/api/' + next_href, video_id) 'https://iview.abc.net.au/api/' + href, video_id)
entries.append(self._extract_from_video_params(video_id, video_params)) entries.append(self._extract_from_video_params(video_id, video_params))
next_href = video_params.get('nextEpisode').get('href')
return { return {
'_type': 'playlist', '_type': 'playlist',
'title': entries[0].get('series'), 'title': series_params.get('seriesTitle'),
'description': entries[0].get('description'), 'description': series_params.get('seriesDescription'),
'uploader_id': entries[0].get('uploader_id'), 'uploader_id': entries[0].get('uploader_id'),
'entries': entries 'entries': entries
} }

View File

@ -4,7 +4,7 @@ from __future__ import unicode_literals
from .abc import ( from .abc import (
ABCIE, ABCIE,
ABCIViewIE, ABCIViewIE,
ABCIViewShowIE, ABCIViewSeriesIE,
) )
from .abcnews import ( from .abcnews import (
AbcNewsIE, AbcNewsIE,