Cleaned up all of the code.

Changed auth around so you don't need to use if statements and more. :/
This commit is contained in:
TheDaChicken 2018-09-11 15:38:19 -07:00 committed by GitHub
parent f4dde36bf9
commit 2f165c999a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,21 +26,18 @@ class CartoonNetworkIE(TurnerBaseIE):
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)
video_id = self._html_search_regex(r'[^>]+.mediaId = "(.+?)"', webpage, 'video_id') video_id = self._html_search_regex(r'[^>]+.mediaId = "(.+?)"', webpage, 'video_id')
title = self._html_search_regex(r'[^>]+.episodeTitle = "(.+?)"', webpage, 'title') title = self._html_search_regex(r'[^>]+.episodeTitle[^>]*"(.+?)"', webpage, 'title')
auth = self._html_search_regex(r'[^>]+currentVideo.authType = "(.+?)"', webpage, 'authType') description = self._html_search_regex(r'[^>]+description[^>]*>(.+?)<', webpage, 'description', default=None)
if "auth" in auth: print(video_id)
auth_required = 'true'
if "unauth" in auth:
auth_required = '' #Auth needs to be first due to Auth being in unauth. :/
videoType = self._html_search_regex(r'[^>]+.videoType = "(.+?)"', webpage, 'videoType')
description = self._html_search_regex(r'id="[^>]+description[^>]*>(.+?)</div>', webpage, 'description', default=None)
info = self._extract_ngtv_info( info = self._extract_ngtv_info(
video_id, video_id,
{'networkId': 'cartoonnetwork'}, {'networkId': 'cartoonnetwork'},
{ {
'url': url, 'url': url,
'site_name': 'CartoonNetwork', 'site_name': 'CartoonNetwork',
'auth_required': auth_required, 'auth_required': self._search_regex(
r'[^>]+currentVideo.authType = "(auth|unauth)"',
webpage, 'auth required', default='false') == 'auth',
}, },
) )
info.update({ info.update({