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.

37 lines
1.2 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. import json
  4. from .common import InfoExtractor
  5. class FreespeechIE(InfoExtractor):
  6. IE_NAME = 'freespeech.org'
  7. _VALID_URL = r'https://www\.freespeech\.org/video/(?P<title>.+)'
  8. _TEST = {
  9. 'add_ie': ['Youtube'],
  10. 'url': 'https://www.freespeech.org/video/obama-romney-campaign-colorado-ahead-debate-0',
  11. 'info_dict': {
  12. 'id': 'poKsVCZ64uU',
  13. 'ext': 'webm',
  14. 'title': 'Obama, Romney Campaign in Colorado Ahead of Debate',
  15. 'description': 'Obama, Romney Campaign in Colorado Ahead of Debate',
  16. 'uploader': 'freespeechtv',
  17. 'uploader_id': 'freespeechtv',
  18. 'upload_date': '20121002',
  19. },
  20. }
  21. def _real_extract(self, url):
  22. mobj = re.match(self._VALID_URL, url)
  23. title = mobj.group('title')
  24. webpage = self._download_webpage(url, title)
  25. info_json = self._search_regex(r'jQuery.extend\(Drupal.settings, ({.*?})\);', webpage, 'info')
  26. info = json.loads(info_json)
  27. return {
  28. '_type': 'url',
  29. 'url': info['jw_player']['basic_video_node_player']['file'],
  30. 'ie_key': 'Youtube',
  31. }