]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[azmedien:playlist] Add support for topic and themen playlists
authorAlex Seiler <seileralex@gmail.com>
Sat, 28 Jan 2017 16:52:07 +0000 (17:52 +0100)
committerSergey M․ <dstftw@gmail.com>
Sun, 29 Jan 2017 13:40:19 +0000 (20:40 +0700)
youtube_dl/extractor/azmedien.py
youtube_dl/extractor/extractors.py

index a89f71c20c08ac95cd5e78814afe5da783ed2ca3..cbc3ed5640ca00818144abf312ee65c896207a2a 100644 (file)
@@ -5,8 +5,9 @@ import re
 from .common import InfoExtractor
 from .kaltura import KalturaIE
 from ..utils import (
-    get_element_by_class,
+    get_element_by_id,
     strip_or_none,
+    urljoin,
 )
 
 
@@ -83,8 +84,8 @@ class AZMedienIE(AZMedienBaseIE):
         return self._kaltura_video(partner_id, entry_id)
 
 
-class AZMedienShowIE(AZMedienBaseIE):
-    IE_DESC = 'AZ Medien shows'
+class AZMedienPlaylistIE(AZMedienBaseIE):
+    IE_DESC = 'AZ Medien playlists'
     _VALID_URL = r'''(?x)
                     https?://
                         (?:www\.)?
@@ -93,7 +94,12 @@ class AZMedienShowIE(AZMedienBaseIE):
                             telebaern\.tv|
                             telem1\.ch
                         )/
-                        (?P<id>[0-9]+-show-[^/\#]+
+                        (?P<id>[0-9]+-
+                            (?:
+                                show|
+                                topic|
+                                themen
+                            )-[^/\#]+
                             (?:
                                 /[0-9]+-episode-[^/\#]+
                             )?
@@ -108,6 +114,18 @@ class AZMedienShowIE(AZMedienBaseIE):
             'title': 'News - Donnerstag, 15. Dezember 2016',
         },
         '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': 'http://www.telezueri.ch/86-show-talktaeglich',
@@ -136,10 +154,19 @@ class AZMedienShowIE(AZMedienBaseIE):
                 for m in re.finditer(
                     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(
             r'episodeShareTitle\s*=\s*(["\'])(?P<title>(?:(?!\1).)+)\1',
             webpage, 'title',
-            default=strip_or_none(get_element_by_class(
-                'title-block-cell', webpage)), group='title')
+            default=strip_or_none(get_element_by_id(
+                'video-title', webpage)), group='title')
 
         return self.playlist_result(entries, show_id, title)
index 086a2296dcdd014e19e6fff19ac4de8682f571b3..2590b5e1b2ac3c1c5594844e8cb9d86d2bbfc530 100644 (file)
@@ -82,7 +82,7 @@ from .awaan import (
 )
 from .azmedien import (
     AZMedienIE,
-    AZMedienShowIE,
+    AZMedienPlaylistIE,
 )
 from .azubu import AzubuIE, AzubuLiveIE
 from .baidu import BaiduVideoIE