mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-04-01 04:37:27 +09:00
Compare commits
No commits in common. "0370d9eb3dd3b6779cb88fe128fe870fdfb2ea58" and "0ee78d62d5d98d30f5b26e76504660adae01bd19" have entirely different histories.
0370d9eb3d
...
0ee78d62d5
@ -3,62 +3,50 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
from .adobepass import AdobePassIE
|
from .adobepass import AdobePassIE
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
int_or_none,
|
extract_attributes,
|
||||||
smuggle_url,
|
|
||||||
update_url_query,
|
update_url_query,
|
||||||
|
smuggle_url,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SproutIE(AdobePassIE):
|
class SproutIE(AdobePassIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?(?:sproutonline|universalkids)\.com/(?:watch|(?:[^/]+/)*videos)/(?P<id>[^/?#]+)'
|
_VALID_URL = r'https?://(?:www\.)?sproutonline\.com/watch/(?P<id>[^/?#]+)'
|
||||||
_TESTS = [{
|
_TEST = {
|
||||||
'url': 'https://www.universalkids.com/shows/remy-and-boo/season/1/videos/robot-bike-race',
|
|
||||||
'info_dict': {
|
|
||||||
'id': 'bm0foJFaTKqb',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': 'Robot Bike Race',
|
|
||||||
'description': 'md5:436b1d97117cc437f54c383f4debc66d',
|
|
||||||
'timestamp': 1606148940,
|
|
||||||
'upload_date': '20201123',
|
|
||||||
'uploader': 'NBCU-MPAT',
|
|
||||||
},
|
|
||||||
'params': {
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
'url': 'http://www.sproutonline.com/watch/cowboy-adventure',
|
'url': 'http://www.sproutonline.com/watch/cowboy-adventure',
|
||||||
'only_matching': True,
|
'md5': '74bf14128578d1e040c3ebc82088f45f',
|
||||||
}, {
|
'info_dict': {
|
||||||
'url': 'https://www.universalkids.com/watch/robot-bike-race',
|
'id': '9dexnwtmh8_X',
|
||||||
'only_matching': True,
|
'ext': 'mp4',
|
||||||
}]
|
'title': 'A Cowboy Adventure',
|
||||||
_GEO_COUNTRIES = ['US']
|
'description': 'Ruff-Ruff, Tweet and Dave get to be cowboys for the day at Six Cow Corral.',
|
||||||
|
'timestamp': 1437758640,
|
||||||
|
'upload_date': '20150724',
|
||||||
|
'uploader': 'NBCU-SPROUT-NEW',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
display_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
mpx_metadata = self._download_json(
|
webpage = self._download_webpage(url, video_id)
|
||||||
# http://nbcuunikidsprod.apps.nbcuni.com/networks/universalkids/content/videos/
|
video_component = self._search_regex(
|
||||||
'https://www.universalkids.com/_api/videos/' + display_id,
|
r'(?s)(<div[^>]+data-component="video"[^>]*?>)',
|
||||||
display_id)['mpxMetadata']
|
webpage, 'video component', default=None)
|
||||||
media_pid = mpx_metadata['mediaPid']
|
if video_component:
|
||||||
theplatform_url = 'https://link.theplatform.com/s/HNK2IC/' + media_pid
|
options = self._parse_json(extract_attributes(
|
||||||
|
video_component)['data-options'], video_id)
|
||||||
|
theplatform_url = options['video']
|
||||||
query = {
|
query = {
|
||||||
'mbr': 'true',
|
'mbr': 'true',
|
||||||
'manifest': 'm3u',
|
'manifest': 'm3u',
|
||||||
}
|
}
|
||||||
if mpx_metadata.get('entitlement') == 'auth':
|
if options.get('protected'):
|
||||||
query['auth'] = self._extract_mvpd_auth(url, media_pid, 'sprout', 'sprout')
|
query['auth'] = self._extract_mvpd_auth(url, options['pid'], 'sprout', 'sprout')
|
||||||
theplatform_url = smuggle_url(
|
theplatform_url = smuggle_url(update_url_query(
|
||||||
update_url_query(theplatform_url, query), {
|
theplatform_url, query), {'force_smil_url': True})
|
||||||
'force_smil_url': True,
|
else:
|
||||||
'geo_countries': self._GEO_COUNTRIES,
|
iframe = self._search_regex(
|
||||||
})
|
r'(<iframe[^>]+id="sproutVideoIframe"[^>]*?>)',
|
||||||
return {
|
webpage, 'iframe')
|
||||||
'_type': 'url_transparent',
|
theplatform_url = extract_attributes(iframe)['src']
|
||||||
'id': media_pid,
|
|
||||||
'url': theplatform_url,
|
return self.url_result(theplatform_url, 'ThePlatform')
|
||||||
'series': mpx_metadata.get('seriesName'),
|
|
||||||
'season_number': int_or_none(mpx_metadata.get('seasonNumber')),
|
|
||||||
'episode_number': int_or_none(mpx_metadata.get('episodeNumber')),
|
|
||||||
'ie_key': 'ThePlatform',
|
|
||||||
}
|
|
||||||
|
@ -234,9 +234,6 @@ class ThePlatformIE(ThePlatformBaseIE, AdobePassIE):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
url, smuggled_data = unsmuggle_url(url, {})
|
url, smuggled_data = unsmuggle_url(url, {})
|
||||||
self._initialize_geo_bypass({
|
|
||||||
'countries': smuggled_data.get('geo_countries'),
|
|
||||||
})
|
|
||||||
|
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
provider_id = mobj.group('provider_id')
|
provider_id = mobj.group('provider_id')
|
||||||
|
Loading…
Reference in New Issue
Block a user