logo

youtube-dl

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

freespeech.py (1057B)


  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from .youtube import YoutubeIE
  4. class FreespeechIE(InfoExtractor):
  5. IE_NAME = 'freespeech.org'
  6. _VALID_URL = r'https?://(?:www\.)?freespeech\.org/stories/(?P<id>.+)'
  7. _TEST = {
  8. 'add_ie': ['Youtube'],
  9. 'url': 'http://www.freespeech.org/stories/fcc-announces-net-neutrality-rollback-whats-stake/',
  10. 'info_dict': {
  11. 'id': 'waRk6IPqyWM',
  12. 'ext': 'mp4',
  13. 'title': 'What\'s At Stake - Net Neutrality Special',
  14. 'description': 'Presented by MNN and FSTV',
  15. 'upload_date': '20170728',
  16. 'uploader_id': 'freespeechtv',
  17. 'uploader': 'freespeechtv',
  18. },
  19. }
  20. def _real_extract(self, url):
  21. display_id = self._match_id(url)
  22. webpage = self._download_webpage(url, display_id)
  23. youtube_url = self._search_regex(
  24. r'data-video-url="([^"]+)"',
  25. webpage, 'youtube url')
  26. return self.url_result(youtube_url, YoutubeIE.ie_key())