mirror of
https://github.com/l1ving/youtube-dl
synced 2025-01-24 17:56:07 +08:00
[EllenTV] Improve
This commit is contained in:
parent
e7ac722d62
commit
af6199b6e1
@ -1,9 +1,8 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from .kaltura import KalturaIE
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
NO_DEFAULT,
|
NO_DEFAULT,
|
||||||
@ -65,7 +64,7 @@ class EllenTVIE(InfoExtractor):
|
|||||||
if partner_id and kaltura_id:
|
if partner_id and kaltura_id:
|
||||||
break
|
break
|
||||||
|
|
||||||
return self.url_result('kaltura:%s:%s' % (partner_id, kaltura_id), 'Kaltura')
|
return self.url_result('kaltura:%s:%s' % (partner_id, kaltura_id), KalturaIE.ie_key())
|
||||||
|
|
||||||
|
|
||||||
class EllenTVClipsIE(InfoExtractor):
|
class EllenTVClipsIE(InfoExtractor):
|
||||||
@ -77,7 +76,7 @@ class EllenTVClipsIE(InfoExtractor):
|
|||||||
'id': 'meryl-streep-vanessa-hudgens',
|
'id': 'meryl-streep-vanessa-hudgens',
|
||||||
'title': 'Meryl Streep, Vanessa Hudgens',
|
'title': 'Meryl Streep, Vanessa Hudgens',
|
||||||
},
|
},
|
||||||
'playlist_mincount': 7,
|
'playlist_mincount': 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -96,7 +95,7 @@ class EllenTVClipsIE(InfoExtractor):
|
|||||||
def _extract_playlist(self, webpage):
|
def _extract_playlist(self, webpage):
|
||||||
json_string = self._search_regex(r'playerView.addClips\(\[\{(.*?)\}\]\);', webpage, 'json')
|
json_string = self._search_regex(r'playerView.addClips\(\[\{(.*?)\}\]\);', webpage, 'json')
|
||||||
try:
|
try:
|
||||||
return json.loads('[{' + json_string + '}]')
|
return self._parse_json('[{' + json_string + '}]', 'playlist')
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
raise ExtractorError('Failed to download JSON', cause=ve)
|
raise ExtractorError('Failed to download JSON', cause=ve)
|
||||||
|
|
||||||
@ -104,5 +103,5 @@ class EllenTVClipsIE(InfoExtractor):
|
|||||||
return [
|
return [
|
||||||
self.url_result(
|
self.url_result(
|
||||||
'kaltura:%s:%s' % (item['kaltura_partner_id'], item['kaltura_entry_id']),
|
'kaltura:%s:%s' % (item['kaltura_partner_id'], item['kaltura_entry_id']),
|
||||||
'Kaltura')
|
KalturaIE.ie_key())
|
||||||
for item in playlist]
|
for item in playlist]
|
||||||
|
Loading…
Reference in New Issue
Block a user