[azmedien:playlist] Add support for topic and themen playlists

This commit is contained in:
Alex Seiler 2017-01-28 17:52:07 +01:00 committed by Sergey M․
parent e228616c6e
commit f13da8af28
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D
2 changed files with 34 additions and 7 deletions

View file

@ -5,8 +5,9 @@
from .common import InfoExtractor from .common import InfoExtractor
from .kaltura import KalturaIE from .kaltura import KalturaIE
from ..utils import ( from ..utils import (
get_element_by_class, get_element_by_id,
strip_or_none, strip_or_none,
urljoin,
) )
@ -83,8 +84,8 @@ def _real_extract(self, url):
return self._kaltura_video(partner_id, entry_id) return self._kaltura_video(partner_id, entry_id)
class AZMedienShowIE(AZMedienBaseIE): class AZMedienPlaylistIE(AZMedienBaseIE):
IE_DESC = 'AZ Medien shows' IE_DESC = 'AZ Medien playlists'
_VALID_URL = r'''(?x) _VALID_URL = r'''(?x)
https?:// https?://
(?:www\.)? (?:www\.)?
@ -93,7 +94,12 @@ class AZMedienShowIE(AZMedienBaseIE):
telebaern\.tv| telebaern\.tv|
telem1\.ch telem1\.ch
)/ )/
(?P<id>[0-9]+-show-[^/\#]+ (?P<id>[0-9]+-
(?:
show|
topic|
themen
)-[^/\#]+
(?: (?:
/[0-9]+-episode-[^/\#]+ /[0-9]+-episode-[^/\#]+
)? )?
@ -108,6 +114,18 @@ class AZMedienShowIE(AZMedienBaseIE):
'title': 'News - Donnerstag, 15. Dezember 2016', 'title': 'News - Donnerstag, 15. Dezember 2016',
}, },
'playlist_count': 9, 'playlist_count': 9,
}, {
# URL with 'themen'
'url': 'http://www.telem1.ch/258-themen-tele-m1-classics',
'info_dict': {
'id': '258-themen-tele-m1-classics',
'title': 'Tele M1 Classics',
},
'playlist_mincount': 15,
}, {
# URL with 'topic', contains nested playlists
'url': 'http://www.telezueri.ch/219-topic-aera-trump-hat-offiziell-begonnen',
'only_matching': True,
}, { }, {
# URL with 'show' only # URL with 'show' only
'url': 'http://www.telezueri.ch/86-show-talktaeglich', 'url': 'http://www.telezueri.ch/86-show-talktaeglich',
@ -136,10 +154,19 @@ def _real_extract(self, url):
for m in re.finditer( for m in re.finditer(
r'<a[^>]+data-real=(["\'])(?P<url>http.+?)\1', webpage)] r'<a[^>]+data-real=(["\'])(?P<url>http.+?)\1', webpage)]
if not entries:
entries = [
# May contain nested playlists (e.g. [1]) thus no explicit
# ie_key
# 1. http://www.telezueri.ch/219-topic-aera-trump-hat-offiziell-begonnen)
self.url_result(urljoin(url, m.group('url')))
for m in re.finditer(
r'<a[^>]+name=[^>]+href=(["\'])(?P<url>/.+?)\1', webpage)]
title = self._search_regex( title = self._search_regex(
r'episodeShareTitle\s*=\s*(["\'])(?P<title>(?:(?!\1).)+)\1', r'episodeShareTitle\s*=\s*(["\'])(?P<title>(?:(?!\1).)+)\1',
webpage, 'title', webpage, 'title',
default=strip_or_none(get_element_by_class( default=strip_or_none(get_element_by_id(
'title-block-cell', webpage)), group='title') 'video-title', webpage)), group='title')
return self.playlist_result(entries, show_id, title) return self.playlist_result(entries, show_id, title)

View file

@ -82,7 +82,7 @@
) )
from .azmedien import ( from .azmedien import (
AZMedienIE, AZMedienIE,
AZMedienShowIE, AZMedienPlaylistIE,
) )
from .azubu import AzubuIE, AzubuLiveIE from .azubu import AzubuIE, AzubuLiveIE
from .baidu import BaiduVideoIE from .baidu import BaiduVideoIE