nrl.py 932 B

123456789101112131415161718192021222324252627
  1. from .common import InfoExtractor
  2. class NRLTVIE(InfoExtractor):
  3. _VALID_URL = r'https?://(?:www\.)?nrl\.com/tv(/[^/]+)*/(?P<id>[^/?&#]+)'
  4. _TEST = {
  5. 'url': 'https://www.nrl.com/tv/news/match-highlights-titans-v-knights-862805/',
  6. 'info_dict': {
  7. 'id': 'YyNnFuaDE6kPJqlDhG4CGQ_w89mKTau4',
  8. 'ext': 'mp4',
  9. 'title': 'Match Highlights: Titans v Knights',
  10. },
  11. 'params': {
  12. # m3u8 download
  13. 'skip_download': True,
  14. },
  15. }
  16. def _real_extract(self, url):
  17. display_id = self._match_id(url)
  18. webpage = self._download_webpage(url, display_id)
  19. q_data = self._parse_json(self._html_search_regex(
  20. r'(?s)q-data="({.+?})"', webpage, 'player data'), display_id)
  21. ooyala_id = q_data['videoId']
  22. return self.url_result(
  23. 'ooyala:' + ooyala_id, 'Ooyala', ooyala_id, q_data.get('title'))