summaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/nerdcubed.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:49:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:49:24 +0000
commit2415e66f889f38503b73e8ebc5f43ca342390e5c (patch)
treeac48ab69d1d96bae3d83756134921e0d90593aa5 /yt_dlp/extractor/nerdcubed.py
parentInitial commit. (diff)
downloadyt-dlp-2415e66f889f38503b73e8ebc5f43ca342390e5c.tar.xz
yt-dlp-2415e66f889f38503b73e8ebc5f43ca342390e5c.zip
Adding upstream version 2024.03.10.upstream/2024.03.10
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/extractor/nerdcubed.py')
-rw-r--r--yt_dlp/extractor/nerdcubed.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/yt_dlp/extractor/nerdcubed.py b/yt_dlp/extractor/nerdcubed.py
new file mode 100644
index 0000000..5f5607a
--- /dev/null
+++ b/yt_dlp/extractor/nerdcubed.py
@@ -0,0 +1,38 @@
+from .common import InfoExtractor
+from .youtube import YoutubeIE
+from ..utils import parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
+
+
+class NerdCubedFeedIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nerdcubed\.co\.uk/?(?:$|[#?])'
+ _TEST = {
+ 'url': 'http://www.nerdcubed.co.uk/',
+ 'info_dict': {
+ 'id': 'nerdcubed-feed',
+ 'title': 'nerdcubed.co.uk feed',
+ },
+ 'playlist_mincount': 5500,
+ }
+
+ def _extract_video(self, feed_entry):
+ return self.url_result(
+ f'https://www.youtube.com/watch?v={feed_entry["id"]}', YoutubeIE,
+ **traverse_obj(feed_entry, {
+ 'id': ('id', {str}),
+ 'title': ('title', {str}),
+ 'description': ('description', {str}),
+ 'timestamp': ('publishedAt', {parse_iso8601}),
+ 'channel': ('source', 'name', {str}),
+ 'channel_id': ('source', 'id', {str}),
+ 'channel_url': ('source', 'url', {str}),
+ 'thumbnail': ('thumbnail', 'source', {url_or_none}),
+ }), url_transparent=True)
+
+ def _real_extract(self, url):
+ video_id = 'nerdcubed-feed'
+ feed = self._download_json('https://www.nerdcubed.co.uk/_/cdn/videos.json', video_id)
+
+ return self.playlist_result(
+ map(self._extract_video, traverse_obj(feed, ('videos', lambda _, v: v['id']))),
+ video_id, 'nerdcubed.co.uk feed')