europeantour.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import re
  2. from .common import InfoExtractor
  3. class EuropeanTourIE(InfoExtractor):
  4. _VALID_URL = r'https?://(?:www\.)?europeantour\.com/dpworld-tour/news/video/(?P<id>[^/&?#$]+)'
  5. _TESTS = [{
  6. 'url': 'https://www.europeantour.com/dpworld-tour/news/video/the-best-shots-of-the-2021-seasons/',
  7. 'info_dict': {
  8. 'id': '6287788195001',
  9. 'ext': 'mp4',
  10. 'title': 'The best shots of the 2021 seasons',
  11. 'duration': 2416.512,
  12. 'timestamp': 1640010141,
  13. 'uploader_id': '5136026580001',
  14. 'tags': ['prod-imported'],
  15. 'thumbnail': 'md5:fdac52bc826548860edf8145ee74e71a',
  16. 'upload_date': '20211220',
  17. },
  18. 'params': {'skip_download': True},
  19. }]
  20. BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s'
  21. def _real_extract(self, url):
  22. video_id = self._match_id(url)
  23. webpage = self._download_webpage(url, video_id)
  24. vid, aid = re.search(r'(?s)brightcove-player\s?video-id="([^"]+)".*"ACCOUNT_ID":"([^"]+)"', webpage).groups()
  25. if not aid:
  26. aid = '5136026580001'
  27. return self.url_result(
  28. self.BRIGHTCOVE_URL_TEMPLATE % (aid, vid), 'BrightcoveNew')