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