[sprout] Add support for Universal Kids (closes #22518)
This commit is contained in:
parent
2c312ab84a
commit
1434651d20
|
@ -3,50 +3,62 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from .adobepass import AdobePassIE
|
from .adobepass import AdobePassIE
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
extract_attributes,
|
int_or_none,
|
||||||
update_url_query,
|
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
|
update_url_query,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SproutIE(AdobePassIE):
|
class SproutIE(AdobePassIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?sproutonline\.com/watch/(?P<id>[^/?#]+)'
|
_VALID_URL = r'https?://(?:www\.)?(?:sproutonline|universalkids)\.com/(?:watch|(?:[^/]+/)*videos)/(?P<id>[^/?#]+)'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://www.sproutonline.com/watch/cowboy-adventure',
|
'url': 'https://www.universalkids.com/shows/remy-and-boo/season/1/videos/robot-bike-race',
|
||||||
'md5': '74bf14128578d1e040c3ebc82088f45f',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '9dexnwtmh8_X',
|
'id': 'bm0foJFaTKqb',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'A Cowboy Adventure',
|
'title': 'Robot Bike Race',
|
||||||
'description': 'Ruff-Ruff, Tweet and Dave get to be cowboys for the day at Six Cow Corral.',
|
'description': 'md5:436b1d97117cc437f54c383f4debc66d',
|
||||||
'timestamp': 1437758640,
|
'timestamp': 1606148940,
|
||||||
'upload_date': '20150724',
|
'upload_date': '20201123',
|
||||||
'uploader': 'NBCU-SPROUT-NEW',
|
'uploader': 'NBCU-MPAT',
|
||||||
}
|
},
|
||||||
}
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://www.sproutonline.com/watch/cowboy-adventure',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.universalkids.com/watch/robot-bike-race',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
_GEO_COUNTRIES = ['US']
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
display_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
mpx_metadata = self._download_json(
|
||||||
video_component = self._search_regex(
|
# http://nbcuunikidsprod.apps.nbcuni.com/networks/universalkids/content/videos/
|
||||||
r'(?s)(<div[^>]+data-component="video"[^>]*?>)',
|
'https://www.universalkids.com/_api/videos/' + display_id,
|
||||||
webpage, 'video component', default=None)
|
display_id)['mpxMetadata']
|
||||||
if video_component:
|
media_pid = mpx_metadata['mediaPid']
|
||||||
options = self._parse_json(extract_attributes(
|
theplatform_url = 'https://link.theplatform.com/s/HNK2IC/' + media_pid
|
||||||
video_component)['data-options'], video_id)
|
query = {
|
||||||
theplatform_url = options['video']
|
'mbr': 'true',
|
||||||
query = {
|
'manifest': 'm3u',
|
||||||
'mbr': 'true',
|
}
|
||||||
'manifest': 'm3u',
|
if mpx_metadata.get('entitlement') == 'auth':
|
||||||
}
|
query['auth'] = self._extract_mvpd_auth(url, media_pid, 'sprout', 'sprout')
|
||||||
if options.get('protected'):
|
theplatform_url = smuggle_url(
|
||||||
query['auth'] = self._extract_mvpd_auth(url, options['pid'], 'sprout', 'sprout')
|
update_url_query(theplatform_url, query), {
|
||||||
theplatform_url = smuggle_url(update_url_query(
|
'force_smil_url': True,
|
||||||
theplatform_url, query), {'force_smil_url': True})
|
'geo_countries': self._GEO_COUNTRIES,
|
||||||
else:
|
})
|
||||||
iframe = self._search_regex(
|
return {
|
||||||
r'(<iframe[^>]+id="sproutVideoIframe"[^>]*?>)',
|
'_type': 'url_transparent',
|
||||||
webpage, 'iframe')
|
'id': 'id',
|
||||||
theplatform_url = extract_attributes(iframe)['src']
|
'url': theplatform_url,
|
||||||
|
'series': mpx_metadata.get('seriesName'),
|
||||||
return self.url_result(theplatform_url, 'ThePlatform')
|
'season_number': int_or_none(mpx_metadata.get('seasonNumber')),
|
||||||
|
'episode_number': int_or_none(mpx_metadata.get('episodeNumber')),
|
||||||
|
'ie_key': 'ThePlatform',
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue