1 from .common
import InfoExtractor
2 from .youtube
import YoutubeIE
3 from ..utils
import parse_iso8601
, url_or_none
4 from ..utils
.traversal
import traverse_obj
7 class NerdCubedFeedIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(?:www\.)?nerdcubed\.co\.uk/?(?:$|[#?])'
10 'url': 'http://www.nerdcubed.co.uk/',
12 'id': 'nerdcubed-feed',
13 'title': 'nerdcubed.co.uk feed',
15 'playlist_mincount': 5500,
18 def _extract_video(self
, feed_entry
):
19 return self
.url_result(
20 f
'https://www.youtube.com/watch?v={feed_entry["id"]}', YoutubeIE
,
21 **traverse_obj(feed_entry
, {
23 'title': ('title', {str}
),
24 'description': ('description', {str}
),
25 'timestamp': ('publishedAt', {parse_iso8601}
),
26 'channel': ('source', 'name', {str}
),
27 'channel_id': ('source', 'id', {str}
),
28 'channel_url': ('source', 'url', {str}
),
29 'thumbnail': ('thumbnail', 'source', {url_or_none}
),
30 }), url_transparent
=True)
32 def _real_extract(self
, url
):
33 video_id
= 'nerdcubed-feed'
34 feed
= self
._download
_json
('https://www.nerdcubed.co.uk/_/cdn/videos.json', video_id
)
36 return self
.playlist_result(
37 map(self
._extract
_video
, traverse_obj(feed
, ('videos', lambda _
, v
: v
['id']))),
38 video_id
, 'nerdcubed.co.uk feed')