]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nerdcubed.py
New upstream version 2019.01.16
[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 'id': 'nerdcubed-feed',
15 'title': 'nerdcubed.co.uk feed',
16 },
17 'playlist_mincount': 1300,
18 }
19
20 def _real_extract(self, url):
21 feed = self._download_json(url, url, 'Downloading NerdCubed JSON feed')
22
23 entries = [{
24 '_type': 'url',
25 'title': feed_entry['title'],
26 'uploader': feed_entry['source']['name'] if feed_entry['source'] else None,
27 'upload_date': datetime.datetime.strptime(feed_entry['date'], '%Y-%m-%d').strftime('%Y%m%d'),
28 'url': 'http://www.youtube.com/watch?v=' + feed_entry['youtube_id'],
29 } for feed_entry in feed]
30
31 return {
32 '_type': 'playlist',
33 'title': 'nerdcubed.co.uk feed',
34 'id': 'nerdcubed-feed',
35 'entries': entries,
36 }