logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

nerdcubed.py (1131B)


  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. 'id': 'nerdcubed-feed',
  11. 'title': 'nerdcubed.co.uk feed',
  12. },
  13. 'playlist_mincount': 1300,
  14. }
  15. def _real_extract(self, url):
  16. feed = self._download_json(url, url, 'Downloading NerdCubed JSON feed')
  17. entries = [{
  18. '_type': 'url',
  19. 'title': feed_entry['title'],
  20. 'uploader': feed_entry['source']['name'] if feed_entry['source'] else None,
  21. 'upload_date': datetime.datetime.strptime(feed_entry['date'], '%Y-%m-%d').strftime('%Y%m%d'),
  22. 'url': 'http://www.youtube.com/watch?v=' + feed_entry['youtube_id'],
  23. } for feed_entry in feed]
  24. return {
  25. '_type': 'playlist',
  26. 'title': 'nerdcubed.co.uk feed',
  27. 'id': 'nerdcubed-feed',
  28. 'entries': entries,
  29. }