You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

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