]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nerdcubed.py
debian/changelog: Initiate new release.
[youtubedl] / youtube_dl / extractor / nerdcubed.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import datetime
5
6 from .common import InfoExtractor
7
8
9 class NerdCubedFeedIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?nerdcubed\.co\.uk/feed\.json'
11 _TEST = {
12 'url': 'http://www.nerdcubed.co.uk/feed.json',
13 'info_dict': {
14 'title': 'nerdcubed.co.uk feed',
15 },
16 'playlist_mincount': 1300,
17 }
18
19 def _real_extract(self, url):
20 feed = self._download_json(url, url, "Downloading NerdCubed JSON feed")
21
22 entries = [{
23 '_type': 'url',
24 'title': feed_entry['title'],
25 'uploader': feed_entry['source']['name'] if feed_entry['source'] else None,
26 'upload_date': datetime.datetime.strptime(feed_entry['date'], '%Y-%m-%d').strftime('%Y%m%d'),
27 'url': "http://www.youtube.com/watch?v=" + feed_entry['youtube_id'],
28 } for feed_entry in feed]
29
30 return {
31 '_type': 'playlist',
32 'title': 'nerdcubed.co.uk feed',
33 'id': 'nerdcubed-feed',
34 'entries': entries,
35 }