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.

33 lines
1.2 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class Formula1IE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?formula1\.com/(?:content/fom-website/)?en/video/\d{4}/\d{1,2}/(?P<id>.+?)\.html'
  6. _TESTS = [{
  7. 'url': 'http://www.formula1.com/content/fom-website/en/video/2016/5/Race_highlights_-_Spain_2016.html',
  8. 'md5': '8c79e54be72078b26b89e0e111c0502b',
  9. 'info_dict': {
  10. 'id': 'JvYXJpMzE6pArfHWm5ARp5AiUmD-gibV',
  11. 'ext': 'mp4',
  12. 'title': 'Race highlights - Spain 2016',
  13. },
  14. 'params': {
  15. # m3u8 download
  16. 'skip_download': True,
  17. },
  18. 'add_ie': ['Ooyala'],
  19. }, {
  20. 'url': 'http://www.formula1.com/en/video/2016/5/Race_highlights_-_Spain_2016.html',
  21. 'only_matching': True,
  22. }]
  23. def _real_extract(self, url):
  24. display_id = self._match_id(url)
  25. webpage = self._download_webpage(url, display_id)
  26. ooyala_embed_code = self._search_regex(
  27. r'data-videoid="([^"]+)"', webpage, 'ooyala embed code')
  28. return self.url_result(
  29. 'ooyala:%s' % ooyala_embed_code, 'Ooyala', ooyala_embed_code)