mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-11 02:37:18 +08:00
[cartoonnetwork] Fix for the recent conversion from CVP to NGTV
This commit is contained in:
parent
e06632e3fe
commit
5ee8423f6d
@ -1,20 +1,18 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from .turner import TurnerBaseIE
|
from .turner import TurnerBaseIE
|
||||||
|
|
||||||
|
|
||||||
class CartoonNetworkIE(TurnerBaseIE):
|
class CartoonNetworkIE(TurnerBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?cartoonnetwork\.com/video/(?:[^/]+/)+(?P<id>[^/?#]+)-(?:clip|episode)\.html'
|
_VALID_URL = r'https?://(?:www\.)?cartoonnetwork\.com/video/(?:[^/]+/)+(?P<id>[^/?#]+)-(?:clip|episode)\.html'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.cartoonnetwork.com/video/teen-titans-go/starfire-the-cat-lady-clip.html',
|
'url': 'https://www.cartoonnetwork.com/video/steven-universe/we-are-the-crystal-gems-full-theme-song-music-video-episode.html',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '8a250ab04ed07e6c014ef3f1e2f9016c',
|
'id': '7b1db96d17822fba0a3d1ba4b3c4071852a5078e',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Starfire the Cat Lady',
|
'title': 'We Are the Crystal Gems (Full Theme Song) Music Video',
|
||||||
'description': 'Robin decides to become a cat so that Starfire will finally love him.',
|
'description': 'Music and lyrics by Rebecca Sugar. Additional music by Jeff Liu, Steven Velema and Aivi Tran. Performed by Zach Callison, Estelle, Deedee Magno Hall, Michaela Dietz and Tom Scharpling.',
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
# m3u8 download
|
# m3u8 download
|
||||||
@ -25,18 +23,24 @@ class CartoonNetworkIE(TurnerBaseIE):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
display_id = self._match_id(url)
|
display_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
id_type, video_id = re.search(r"_cnglobal\.cvp(Video|Title)Id\s*=\s*'([^']+)';", webpage).groups()
|
video_id = self._search_regex(r"_cnglobal\.(cvpVideo|cvpTitle|videoMedia)Id\s*=\s*'([^']+)';", webpage, 'video_id', group=2)
|
||||||
query = ('id' if id_type == 'Video' else 'titleId') + '=' + video_id
|
title = self._html_search_regex(r'og:title.*\scontent="([^"]+)"', webpage, 'title', group=1)
|
||||||
return self._extract_cvp_info(
|
description = self._html_search_regex(r'og:description.*\scontent="([^"]+)"', webpage, 'description', default=None, group=1)
|
||||||
'http://www.cartoonnetwork.com/video-seo-svc/episodeservices/getCvpPlaylist?networkName=CN2&' + query, video_id, {
|
|
||||||
'secure': {
|
info = self._extract_ngtv_info(
|
||||||
'media_src': 'http://androidhls-secure.cdn.turner.com/toon/big',
|
video_id,
|
||||||
'tokenizer_src': 'https://token.vgtf.net/token/token_mobile',
|
{'networkId': 'cartoonnetwork'},
|
||||||
},
|
{
|
||||||
}, {
|
|
||||||
'url': url,
|
'url': url,
|
||||||
'site_name': 'CartoonNetwork',
|
'site_name': 'CartoonNetwork',
|
||||||
'auth_required': self._search_regex(
|
'auth_required': self._search_regex(
|
||||||
r'_cnglobal\.cvpFullOrPreviewAuth\s*=\s*(true|false);',
|
r'_cnglobal\.cvpFullOrPreviewAuth\s*=\s*(true|false);',
|
||||||
webpage, 'auth required', default='false') == 'true',
|
webpage, 'auth required', default='false') == 'true',
|
||||||
})
|
},
|
||||||
|
)
|
||||||
|
info.update({
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
})
|
||||||
|
return info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user