1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-26 04:02:11 +00:00

[foxnews] Simplify (Closes #6694)

This commit is contained in:
Sergey M․ 2015-08-27 21:48:03 +06:00
parent 8df8c278b6
commit 1b660cce12

View file

@ -10,7 +10,7 @@ from ..utils import (
class FoxNewsIE(InfoExtractor): class FoxNewsIE(InfoExtractor):
_VALID_URL = r'https?://video\.fox(?:news|business)\.com/v/(?:video-embed\.html\?video_id=)?(?P<id>\d+)' _VALID_URL = r'https?://(?P<host>video\.fox(?:news|business)\.com)/v/(?:video-embed\.html\?video_id=)?(?P<id>\d+)'
_TESTS = [ _TESTS = [
{ {
'url': 'http://video.foxnews.com/v/3937480/frozen-in-time/#sp=show-clips', 'url': 'http://video.foxnews.com/v/3937480/frozen-in-time/#sp=show-clips',
@ -51,12 +51,12 @@ class FoxNewsIE(InfoExtractor):
] ]
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id')
m = re.match(r'^https?://video\.fox(news|business)', url) host = mobj.group('host')
video = self._download_json( video = self._download_json(
'http://video.fox' + m.group(1) + '.com/v/feed/video/%s.js?template=fox' % video_id, video_id) 'http://%s/v/feed/video/%s.js?template=fox' % (host, video_id), video_id)
item = video['channel']['item'] item = video['channel']['item']
title = item['title'] title = item['title']