]>
Commit | Line | Data |
---|---|---|
c58843b3 WG |
1 | import datetime |
2 | ||
3 | from .common import InfoExtractor | |
4 | ||
5 | ||
6 | class NerdCubedFeedIE(InfoExtractor): | |
7 | _VALID_URL = r'https?://(?:www\.)?nerdcubed\.co\.uk/feed\.json' | |
8 | _TEST = { | |
9 | 'url': 'http://www.nerdcubed.co.uk/feed.json', | |
10 | 'info_dict': { | |
14630313 | 11 | 'id': 'nerdcubed-feed', |
c58843b3 WG |
12 | 'title': 'nerdcubed.co.uk feed', |
13 | }, | |
14 | 'playlist_mincount': 1300, | |
15 | } | |
16 | ||
17 | def _real_extract(self, url): | |
611c1dd9 | 18 | feed = self._download_json(url, url, 'Downloading NerdCubed JSON feed') |
1f809a85 | 19 | |
c58843b3 WG |
20 | entries = [{ |
21 | '_type': 'url', | |
22 | 'title': feed_entry['title'], | |
23 | 'uploader': feed_entry['source']['name'] if feed_entry['source'] else None, | |
24 | 'upload_date': datetime.datetime.strptime(feed_entry['date'], '%Y-%m-%d').strftime('%Y%m%d'), | |
611c1dd9 | 25 | 'url': 'http://www.youtube.com/watch?v=' + feed_entry['youtube_id'], |
c58843b3 WG |
26 | } for feed_entry in feed] |
27 | ||
28 | return { | |
29 | '_type': 'playlist', | |
30 | 'title': 'nerdcubed.co.uk feed', | |
31 | 'id': 'nerdcubed-feed', | |
32 | 'entries': entries, | |
33 | } |