2016-08-28 16:47:59 +01:00
# coding: utf-8
from __future__ import unicode_literals
from . turner import TurnerBaseIE
class CartoonNetworkIE ( TurnerBaseIE ) :
_VALID_URL = r ' https?://(?:www \ .)?cartoonnetwork \ .com/video/(?:[^/]+/)+(?P<id>[^/?#]+)-(?:clip|episode) \ .html '
_TEST = {
2018-07-07 23:03:27 -05:00
' url ' : ' https://www.cartoonnetwork.com/video/steven-universe/we-are-the-crystal-gems-full-theme-song-music-video-episode.html ' ,
2016-08-28 16:47:59 +01:00
' info_dict ' : {
2018-07-07 23:03:27 -05:00
' id ' : ' 7b1db96d17822fba0a3d1ba4b3c4071852a5078e ' ,
2016-08-28 16:47:59 +01:00
' ext ' : ' mp4 ' ,
2018-07-07 23:03:27 -05:00
' title ' : ' We Are the Crystal Gems (Full Theme Song) Music Video ' ,
' 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. ' ,
2016-08-28 16:47:59 +01:00
} ,
' params ' : {
# m3u8 download
' skip_download ' : True ,
} ,
}
def _real_extract ( self , url ) :
display_id = self . _match_id ( url )
webpage = self . _download_webpage ( url , display_id )
2018-07-07 23:03:27 -05:00
video_id = self . _search_regex ( r " _cnglobal \ .(cvpVideo|cvpTitle|videoMedia)Id \ s*= \ s* ' ([^ ' ]+) ' ; " , webpage , ' video_id ' , group = 2 )
title = self . _html_search_regex ( r ' og:title.* \ scontent= " ([^ " ]+) " ' , webpage , ' title ' , group = 1 )
description = self . _html_search_regex ( r ' og:description.* \ scontent= " ([^ " ]+) " ' , webpage , ' description ' , default = None , group = 1 )
info = self . _extract_ngtv_info (
video_id ,
{ ' networkId ' : ' cartoonnetwork ' } ,
{
2016-09-20 18:51:29 +01:00
' url ' : url ,
' site_name ' : ' CartoonNetwork ' ,
' auth_required ' : self . _search_regex (
r ' _cnglobal \ .cvpFullOrPreviewAuth \ s*= \ s*(true|false); ' ,
webpage , ' auth required ' , default = ' false ' ) == ' true ' ,
2018-07-07 23:03:27 -05:00
} ,
)
info . update ( {
' id ' : video_id ,
' title ' : title ,
' description ' : description ,
} )
return info