[CartoonNetwork] Made it in the format of everything else.
This commit is contained in:
parent
4611e7d8d0
commit
23ece5268e
@ -1,21 +1,19 @@
|
|||||||
# 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/garnet-gets-a-job-clip.html',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '8a250ab04ed07e6c014ef3f1e2f9016c',
|
'id': '96bc363957a17bc03d16feb86b8391a321f7e670',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Starfire the Cat Lady',
|
'title': 'Garnet Gets a Job',
|
||||||
'description': 'Robin decides to become a cat so that Starfire will finally love him.',
|
'description': 'Garnet and Steven explore the most unlikely timelines in Beach City.',
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
# m3u8 download
|
# m3u8 download
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
@ -25,21 +23,10 @@ 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)
|
||||||
for line in webpage.splitlines():
|
video_id = self._html_search_regex(r'_cnglobal.currentVideo.mediaId = "(.+?)"', webpage, 'video_id')
|
||||||
if "_cnglobal.currentVideo.mediaId" in line:
|
title = self._html_search_regex(r'_cnglobal.currentVideo.episodeTitle = "(.+?)"', webpage, 'title')
|
||||||
simpleid = line.split('mediaId = "',1)[1]
|
auth_required = self._html_search_regex(r'_cnglobal.currentVideo.authType = "(.+?)"', webpage, 'authType')
|
||||||
video_id = simpleid.replace('";', '')
|
description = self._html_search_regex(r'<div id="cn-videopage-ep-description-copy" itemprop="description">(.+?)</div>', webpage, 'authType')
|
||||||
if "_cnglobal.currentVideo.episodeTitle" in line:
|
|
||||||
simpletitle = line.split('episodeTitle = "',1)[1]
|
|
||||||
title = simpletitle.replace('";', '')
|
|
||||||
if "_cnglobal.currentVideo.authType" in line:
|
|
||||||
simpleauth = line.split('authType = "',1)[1]
|
|
||||||
auth = simpleauth.replace('";', '')
|
|
||||||
if "auth" in auth:
|
|
||||||
auth_required = 'true'
|
|
||||||
if "unauth" in auth:
|
|
||||||
auth_required = ''
|
|
||||||
description = ''
|
|
||||||
info = self._extract_ngtv_info(
|
info = self._extract_ngtv_info(
|
||||||
video_id,
|
video_id,
|
||||||
{'networkId': 'cartoonnetwork'},
|
{'networkId': 'cartoonnetwork'},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user