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.

30 lines
1019 B

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