mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-30 14:42:58 +01:00
[localnews8] Fix extractor (Closes #9539)
This commit is contained in:
parent
6756602be6
commit
1846e9ade0
@ -1,29 +1,47 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class LocalNews8IE(InfoExtractor):
|
class LocalNews8IE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?localnews8\.com/.+?/(?P<id>[0-9]+)'
|
_VALID_URL = r'https?://(?:www\.)?localnews8\.com/(?:[^/]+/)*(?P<display_id>[^/]+)/(?P<id>[0-9]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.localnews8.com/news/rexburg-business-turns-carbon-fiber-scraps-into-wedding-rings/35183304',
|
'url': 'http://www.localnews8.com/news/rexburg-business-turns-carbon-fiber-scraps-into-wedding-rings/35183304',
|
||||||
'md5': '477bdb188f177788c65db27ecb56649b',
|
'md5': 'be4d48aea61aa2bde7be2ee47691ad20',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '35183304',
|
'id': '35183304',
|
||||||
|
'display_id': 'rexburg-business-turns-carbon-fiber-scraps-into-wedding-rings',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Rexburg business turns carbon fiber scraps into wedding ring',
|
'title': 'Rexburg business turns carbon fiber scraps into wedding ring',
|
||||||
'description': 'The process was first invented by Lamborghini and less than a dozen companies around the world use it.',
|
'description': 'The process was first invented by Lamborghini and less than a dozen companies around the world use it.',
|
||||||
'duration': '153',
|
'duration': 153,
|
||||||
'timestamp': '1441844822',
|
'timestamp': 1441844822,
|
||||||
|
'upload_date': '20150910',
|
||||||
'uploader_id': 'api',
|
'uploader_id': 'api',
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
video_id = mobj.group('id')
|
||||||
|
display_id = mobj.group('display_id')
|
||||||
|
|
||||||
partner_id = self._search_regex(r'partnerId\s*:\s*"(\d+)"', webpage, video_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
kaltura_id = self._search_regex(r'var\s+videoIdString\s*=\s*"kaltura:(.+)";', webpage, video_id)
|
|
||||||
|
|
||||||
return self.url_result('kaltura:%s:%s' % (partner_id, kaltura_id), 'Kaltura')
|
partner_id = self._search_regex(
|
||||||
|
r'partnerId\s*[:=]\s*(["\'])(?P<id>\d+)\1',
|
||||||
|
webpage, 'partner id', group='id')
|
||||||
|
kaltura_id = self._search_regex(
|
||||||
|
r'videoIdString\s*[:=]\s*(["\'])kaltura:(?P<id>[0-9a-z_]+)\1',
|
||||||
|
webpage, 'videl id', group='id')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'url_transparent',
|
||||||
|
'url': 'kaltura:%s:%s' % (partner_id, kaltura_id),
|
||||||
|
'ie_key': 'Kaltura',
|
||||||
|
'id': video_id,
|
||||||
|
'display_id': display_id,
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user