[ccc:playlist] Add extractor
[youtube-dl] / youtube_dl / extractor / ccc.py
index 73470214412b542adad72f1227e66fd341742e82..a4fdf74e8f220d696d45e2c58721b4d9f11e7546 100644 (file)
@@ -75,3 +75,27 @@ class CCCIE(InfoExtractor):
             'tags': event_data.get('tags'),
             'formats': formats,
         }
+
+
+class CCCPlaylistIE(InfoExtractor):
+    IE_NAME = 'media.ccc.de:lists'
+    _VALID_URL = r'https?://(?:www\.)?media\.ccc\.de/c/(?P<id>[^/?#&]+)'
+    _TESTS = [{
+        'url': 'https://media.ccc.de/c/30c3',
+        'info_dict': {
+            'title': '30C3',
+            'id': '30c3',
+        },
+        'playlist_count': 135,
+    }]
+
+    def _real_extract(self, url):
+        acronym = self._match_id(url).lower()
+
+        conf = self._download_json('https://media.ccc.de/public/conferences/' + acronym, acronym)
+
+        return self.playlist_result(
+            [self.url_result(event['frontend_link']) for event in conf['events']],
+            acronym,
+            conf['title'],
+        )