mirror of https://github.com/blackjack4494/yt-dlc
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.3 KiB
Python
65 lines
2.3 KiB
Python
8 years ago
|
# coding: utf-8
|
||
|
from __future__ import unicode_literals
|
||
|
|
||
|
from .adobepass import AdobePassIE
|
||
|
from ..utils import (
|
||
4 years ago
|
int_or_none,
|
||
8 years ago
|
smuggle_url,
|
||
4 years ago
|
update_url_query,
|
||
8 years ago
|
)
|
||
|
|
||
|
|
||
|
class SproutIE(AdobePassIE):
|
||
4 years ago
|
_VALID_URL = r'https?://(?:www\.)?(?:sproutonline|universalkids)\.com/(?:watch|(?:[^/]+/)*videos)/(?P<id>[^/?#]+)'
|
||
|
_TESTS = [{
|
||
|
'url': 'https://www.universalkids.com/shows/remy-and-boo/season/1/videos/robot-bike-race',
|
||
8 years ago
|
'info_dict': {
|
||
4 years ago
|
'id': 'bm0foJFaTKqb',
|
||
8 years ago
|
'ext': 'mp4',
|
||
4 years ago
|
'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',
|
||
|
'only_matching': True,
|
||
|
}, {
|
||
|
'url': 'https://www.universalkids.com/watch/robot-bike-race',
|
||
|
'only_matching': True,
|
||
|
}]
|
||
|
_GEO_COUNTRIES = ['US']
|
||
8 years ago
|
|
||
|
def _real_extract(self, url):
|
||
4 years ago
|
display_id = self._match_id(url)
|
||
|
mpx_metadata = self._download_json(
|
||
|
# http://nbcuunikidsprod.apps.nbcuni.com/networks/universalkids/content/videos/
|
||
|
'https://www.universalkids.com/_api/videos/' + display_id,
|
||
|
display_id)['mpxMetadata']
|
||
|
media_pid = mpx_metadata['mediaPid']
|
||
|
theplatform_url = 'https://link.theplatform.com/s/HNK2IC/' + media_pid
|
||
|
query = {
|
||
|
'mbr': 'true',
|
||
|
'manifest': 'm3u',
|
||
|
}
|
||
|
if mpx_metadata.get('entitlement') == 'auth':
|
||
|
query['auth'] = self._extract_mvpd_auth(url, media_pid, 'sprout', 'sprout')
|
||
|
theplatform_url = smuggle_url(
|
||
|
update_url_query(theplatform_url, query), {
|
||
|
'force_smil_url': True,
|
||
|
'geo_countries': self._GEO_COUNTRIES,
|
||
|
})
|
||
|
return {
|
||
|
'_type': 'url_transparent',
|
||
|
'id': media_pid,
|
||
|
'url': theplatform_url,
|
||
|
'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',
|
||
|
}
|