Make FoxBusiness work.

This commit is contained in:
nmrugg 2015-08-27 23:24:13 +08:00 committed by Sergey M․
parent f11c316347
commit d7e8264517

View file

@ -1,5 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
parse_iso8601, parse_iso8601,
@ -8,7 +10,7 @@ from ..utils import (
class FoxNewsIE(InfoExtractor): class FoxNewsIE(InfoExtractor):
_VALID_URL = r'https?://video\.foxnews\.com/v/(?:video-embed\.html\?video_id=)?(?P<id>\d+)' _VALID_URL = r'https?://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',
@ -47,8 +49,10 @@ class FoxNewsIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
m = re.match(r'^https?://video\.fox(news|business)', url)
video = self._download_json( video = self._download_json(
'http://video.foxnews.com/v/feed/video/%s.js?template=fox' % video_id, video_id) 'http://video.fox' + m.group(1) + '.com/v/feed/video/%s.js?template=fox' % video_id, video_id)
item = video['channel']['item'] item = video['channel']['item']
title = item['title'] title = item['title']