- }
-
- def _real_extract(self, url):
- mobj = re.match(self._VALID_URL, url)
- video_id = mobj.group('id')
- json_url = 'http://video.nhl.com/videocenter/servlets/playlist?ids=%s&format=json' % video_id
- info_json = self._download_webpage(json_url, video_id,
- u'Downloading info json')
- info_json = self._fix_json(info_json)
- info = json.loads(info_json)[0]
- return self._extract_video(info)
-
-
-class NHLVideocenterIE(NHLBaseInfoExtractor):
- IE_NAME = u'nhl.com:videocenter'
- IE_DESC = u'NHL videocenter category'
- _VALID_URL = r'https?://video\.(?P<team>[^.]*)\.nhl\.com/videocenter/(console\?.*?catid=(?P<catid>[^&]+))?'
-
- @classmethod
- def suitable(cls, url):
- if NHLIE.suitable(url):
- return False
- return super(NHLVideocenterIE, cls).suitable(url)
-
- def _real_extract(self, url):
- mobj = re.match(self._VALID_URL, url)
- team = mobj.group('team')
- webpage = self._download_webpage(url, team)
- cat_id = self._search_regex(
- [r'var defaultCatId = "(.+?)";',
- r'{statusIndex:0,index:0,.*?id:(.*?),'],
- webpage, u'category id')
- playlist_title = self._html_search_regex(
- r'tab0"[^>]*?>(.*?)</td>',
- webpage, u'playlist title', flags=re.DOTALL).lower().capitalize()
-
- data = compat_urllib_parse.urlencode({
- 'cid': cat_id,
- # This is the default value
- 'count': 12,
- 'ptrs': 3,
- 'format': 'json',
- })
- path = '/videocenter/servlets/browse?' + data
- request_url = compat_urlparse.urljoin(url, path)
- response = self._download_webpage(request_url, playlist_title)
- response = self._fix_json(response)
- if not response.strip():
- self._downloader.report_warning(u'Got an empty reponse, trying '
- u'adding the "newvideos" parameter')
- response = self._download_webpage(request_url + '&newvideos=true',
- playlist_title)
- response = self._fix_json(response)
- videos = json.loads(response)
-
- return {
- '_type': 'playlist',
- 'title': playlist_title,
- 'id': cat_id,
- 'entries': [self._extract_video(i) for i in videos],
- }
+ }, {
+ # type=article
+ 'url': 'https://www.nhl.com/news/dennis-wideman-suspended/c-278258934',
+ 'md5': '1f39f4ea74c1394dea110699a25b366c',
+ 'info_dict': {
+ 'id': '40784403',
+ 'ext': 'mp4',
+ 'title': 'Wideman suspended by NHL',
+ 'description': 'Flames defenseman Dennis Wideman was banned 20 games for violation of Rule 40 (Physical Abuse of Officials)',
+ 'upload_date': '20160204',
+ 'timestamp': 1454544904,
+ },
+ }, {
+ # Some m3u8 URLs are invalid (https://github.com/ytdl-org/youtube-dl/issues/10713)
+ 'url': 'https://www.nhl.com/predators/video/poile-laviolette-on-subban-trade/t-277437416/c-44315003',
+ 'md5': '50b2bb47f405121484dda3ccbea25459',
+ 'info_dict': {
+ 'id': '44315003',
+ 'ext': 'mp4',
+ 'title': 'Poile, Laviolette on Subban trade',
+ 'description': 'General manager David Poile and head coach Peter Laviolette share their thoughts on acquiring P.K. Subban from Montreal (06/29/16)',
+ 'timestamp': 1467242866,
+ 'upload_date': '20160629',
+ },
+ }, {
+ 'url': 'https://www.wch2016.com/video/caneur-best-of-game-2-micd-up/t-281230378/c-44983703',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://www.wch2016.com/news/3-stars-team-europe-vs-team-canada/c-282195068',
+ 'only_matching': True,
+ }]