From 091e3cc417eb97b5dc23225b3f024f0dac5e89fc Mon Sep 17 00:00:00 2001 From: GoNotCougsWA Date: Sat, 18 Aug 2018 18:27:16 -0700 Subject: [PATCH 01/20] [CartoonNetwork] Changed cvp to ngtv Changed cvp to ngtv and also fixed AttributeError: 'NoneType' object has no attribute 'groups' --- youtube_dl/extractor/cartoonnetwork.py | 35 ++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 6aeebd7b3..72f73096d 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -25,18 +25,33 @@ class CartoonNetworkIE(TurnerBaseIE): def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) - id_type, video_id = re.search(r"_cnglobal\.cvp(Video|Title)Id\s*=\s*'([^']+)';", webpage).groups() - query = ('id' if id_type == 'Video' else 'titleId') + '=' + video_id - return self._extract_cvp_info( - 'http://www.cartoonnetwork.com/video-seo-svc/episodeservices/getCvpPlaylist?networkName=CN2&' + query, video_id, { - 'secure': { - 'media_src': 'http://androidhls-secure.cdn.turner.com/toon/big', - 'tokenizer_src': 'https://token.vgtf.net/token/token_mobile', - }, - }, { + #id_type, video_id = re.search(r"_cnglobal\.cvp(Video|Title)Id\s*=\s*'([^']+)';", webpage).groups() + #video_id = 'a182d531dab41469af2f3101e1d52ef09465e338' + for line in webpage.splitlines(): + if "_cnglobal.currentVideo.mediaId" in line: + simpleid = line.split('mediaId = "',1)[1] + video_id = simpleid.replace('";', '') + if "_cnglobal.currentVideo.episodeTitle" in line: + simpletitle = line.split('episodeTitle = "',1)[1] + title = simpletitle.replace('";', '') + print(title) + description = '' + #query = ('id' if id_type == 'Video' else 'titleId') + '=' + video_id + + info = self._extract_ngtv_info( + video_id, + {'networkId': 'cartoonnetwork'}, + { 'url': url, 'site_name': 'CartoonNetwork', 'auth_required': self._search_regex( r'_cnglobal\.cvpFullOrPreviewAuth\s*=\s*(true|false);', webpage, 'auth required', default='false') == 'true', - }) + }, + ) + info.update({ + 'id': video_id, + 'title': title, + 'description': description, + }) + return info From fbe332d8a67b506d13ecd742002cc6fed1ea2a92 Mon Sep 17 00:00:00 2001 From: GoNotCougsWA Date: Sat, 18 Aug 2018 18:28:53 -0700 Subject: [PATCH 02/20] Just removed some code that is not needed --- youtube_dl/extractor/cartoonnetwork.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 72f73096d..2b87944c6 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -25,8 +25,6 @@ class CartoonNetworkIE(TurnerBaseIE): def _real_extract(self, url): display_id = self._match_id(url) 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 = 'a182d531dab41469af2f3101e1d52ef09465e338' for line in webpage.splitlines(): if "_cnglobal.currentVideo.mediaId" in line: simpleid = line.split('mediaId = "',1)[1] @@ -36,8 +34,6 @@ class CartoonNetworkIE(TurnerBaseIE): title = simpletitle.replace('";', '') print(title) description = '' - #query = ('id' if id_type == 'Video' else 'titleId') + '=' + video_id - info = self._extract_ngtv_info( video_id, {'networkId': 'cartoonnetwork'}, From 45ef688ed9b3f4aa627db9e8c57f42a1176b0f53 Mon Sep 17 00:00:00 2001 From: GoNotCougsWA Date: Sat, 18 Aug 2018 18:29:34 -0700 Subject: [PATCH 03/20] Removed none needed stuff --- youtube_dl/extractor/cartoonnetwork.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 2b87944c6..356409848 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -31,8 +31,7 @@ class CartoonNetworkIE(TurnerBaseIE): video_id = simpleid.replace('";', '') if "_cnglobal.currentVideo.episodeTitle" in line: simpletitle = line.split('episodeTitle = "',1)[1] - title = simpletitle.replace('";', '') - print(title) + title = simpletitle.replace('";', '') description = '' info = self._extract_ngtv_info( video_id, From 4611e7d8d0cf6eaf5745f8a607019f6542b686a5 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Fri, 24 Aug 2018 17:15:40 -0700 Subject: [PATCH 04/20] Fixed cartoonnetwork not working with Adobe Pass --- youtube_dl/extractor/cartoonnetwork.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 356409848..faf7e10a5 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -31,7 +31,14 @@ class CartoonNetworkIE(TurnerBaseIE): video_id = simpleid.replace('";', '') if "_cnglobal.currentVideo.episodeTitle" in line: simpletitle = line.split('episodeTitle = "',1)[1] - title = simpletitle.replace('";', '') + 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( video_id, @@ -39,9 +46,7 @@ class CartoonNetworkIE(TurnerBaseIE): { 'url': url, 'site_name': 'CartoonNetwork', - 'auth_required': self._search_regex( - r'_cnglobal\.cvpFullOrPreviewAuth\s*=\s*(true|false);', - webpage, 'auth required', default='false') == 'true', + 'auth_required': auth_required, }, ) info.update({ From 23ece5268e6918d306d9f634b20214de6fc7070c Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Mon, 27 Aug 2018 15:23:56 -0700 Subject: [PATCH 05/20] [CartoonNetwork] Made it in the format of everything else. --- youtube_dl/extractor/cartoonnetwork.py | 31 ++++++++------------------ 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index faf7e10a5..a1e324105 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -1,21 +1,19 @@ # coding: utf-8 from __future__ import unicode_literals -import re - from .turner import TurnerBaseIE class CartoonNetworkIE(TurnerBaseIE): _VALID_URL = r'https?://(?:www\.)?cartoonnetwork\.com/video/(?:[^/]+/)+(?P[^/?#]+)-(?:clip|episode)\.html' _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': { - 'id': '8a250ab04ed07e6c014ef3f1e2f9016c', + 'id': '96bc363957a17bc03d16feb86b8391a321f7e670', 'ext': 'mp4', - 'title': 'Starfire the Cat Lady', - 'description': 'Robin decides to become a cat so that Starfire will finally love him.', - }, + 'title': 'Garnet Gets a Job', + 'description': 'Garnet and Steven explore the most unlikely timelines in Beach City.', + }, 'params': { # m3u8 download 'skip_download': True, @@ -25,21 +23,10 @@ class CartoonNetworkIE(TurnerBaseIE): def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) - for line in webpage.splitlines(): - if "_cnglobal.currentVideo.mediaId" in line: - simpleid = line.split('mediaId = "',1)[1] - video_id = simpleid.replace('";', '') - 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 = '' + video_id = self._html_search_regex(r'_cnglobal.currentVideo.mediaId = "(.+?)"', webpage, 'video_id') + title = self._html_search_regex(r'_cnglobal.currentVideo.episodeTitle = "(.+?)"', webpage, 'title') + auth_required = self._html_search_regex(r'_cnglobal.currentVideo.authType = "(.+?)"', webpage, 'authType') + description = self._html_search_regex(r'
(.+?)
', webpage, 'authType') info = self._extract_ngtv_info( video_id, {'networkId': 'cartoonnetwork'}, From 80f77c3b591a61690fd9856d13e6ac17e22d49a9 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Mon, 27 Aug 2018 15:48:01 -0700 Subject: [PATCH 06/20] [CartoonNetwork] Changes stuff I forgot Changed description's label from authType to description --- youtube_dl/extractor/cartoonnetwork.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index a1e324105..810eff47a 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -26,7 +26,7 @@ class CartoonNetworkIE(TurnerBaseIE): video_id = self._html_search_regex(r'_cnglobal.currentVideo.mediaId = "(.+?)"', webpage, 'video_id') title = self._html_search_regex(r'_cnglobal.currentVideo.episodeTitle = "(.+?)"', webpage, 'title') auth_required = self._html_search_regex(r'_cnglobal.currentVideo.authType = "(.+?)"', webpage, 'authType') - description = self._html_search_regex(r'
(.+?)
', webpage, 'authType') + description = self._html_search_regex(r'
(.+?)
', webpage, 'description') info = self._extract_ngtv_info( video_id, {'networkId': 'cartoonnetwork'}, From ccc4c02ece13e616c5b317d5b70594d0eba5266a Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Mon, 27 Aug 2018 16:03:37 -0700 Subject: [PATCH 07/20] [CartoonNetwork] Fixed shortclips ShortClips don't have descriptions, so it will crash but now it's fixed. --- youtube_dl/extractor/cartoonnetwork.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 810eff47a..f267a15da 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -26,7 +26,11 @@ class CartoonNetworkIE(TurnerBaseIE): video_id = self._html_search_regex(r'_cnglobal.currentVideo.mediaId = "(.+?)"', webpage, 'video_id') title = self._html_search_regex(r'_cnglobal.currentVideo.episodeTitle = "(.+?)"', webpage, 'title') auth_required = self._html_search_regex(r'_cnglobal.currentVideo.authType = "(.+?)"', webpage, 'authType') - description = self._html_search_regex(r'
(.+?)
', webpage, 'description') + videoType = self._html_search_regex(r'_cnglobal.currentVideo.videoType = "(.+?)"', webpage, 'videoType') + if 'short' in videoType: + description = '' + else: + description = self._html_search_regex(r'
(.+?)
', webpage, 'description') info = self._extract_ngtv_info( video_id, {'networkId': 'cartoonnetwork'}, From f0b34bccc05a500dba5d5e530938ddabb8300d65 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Mon, 27 Aug 2018 18:17:30 -0700 Subject: [PATCH 08/20] [Cartoonnetwork] Allowing more support if the website changes. --- youtube_dl/extractor/cartoonnetwork.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index f267a15da..a2f711563 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -1,6 +1,8 @@ # coding: utf-8 from __future__ import unicode_literals +import re + from .turner import TurnerBaseIE @@ -23,14 +25,14 @@ class CartoonNetworkIE(TurnerBaseIE): def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) - video_id = self._html_search_regex(r'_cnglobal.currentVideo.mediaId = "(.+?)"', webpage, 'video_id') - title = self._html_search_regex(r'_cnglobal.currentVideo.episodeTitle = "(.+?)"', webpage, 'title') - auth_required = self._html_search_regex(r'_cnglobal.currentVideo.authType = "(.+?)"', webpage, 'authType') - videoType = self._html_search_regex(r'_cnglobal.currentVideo.videoType = "(.+?)"', webpage, 'videoType') + video_id = self._html_search_regex(r'[^>]+.mediaId = "(.+?)"', webpage, 'video_id') + title = self._html_search_regex(r'[^>]+.episodeTitle = "(.+?)"', webpage, 'title') + auth_required = self._html_search_regex(r'[^>]+.authType = "(.+?)"', webpage, 'authType') + videoType = self._html_search_regex(r'[^>]+.videoType = "(.+?)"', webpage, 'videoType') if 'short' in videoType: description = '' else: - description = self._html_search_regex(r'
(.+?)
', webpage, 'description') + description = self._html_search_regex(r'
]+.episodeTitle = "(.+?)"', webpage, 'title') - auth_required = self._html_search_regex(r'[^>]+.authType = "(.+?)"', webpage, 'authType') + auth = self._html_search_regex(r'[^>]+.authType = "(.+?)"', webpage, 'authType') + if "unauth" in auth: + auth_required = 'false' + if "auth" in auth: + auth_required = 'true' videoType = self._html_search_regex(r'[^>]+.videoType = "(.+?)"', webpage, 'videoType') if 'short' in videoType: description = '' else: - description = self._html_search_regex(r'
]+description[^>]*>(.+?)
', webpage, 'description') info = self._extract_ngtv_info( video_id, {'networkId': 'cartoonnetwork'}, From aa359943bbe422fa19fb0cb1df7399a986c1a3a5 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Tue, 4 Sep 2018 17:02:17 -0700 Subject: [PATCH 10/20] Now lets see if that fixed adobe pass. --- youtube_dl/extractor/cartoonnetwork.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 5fb20c45e..60b96a34f 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -29,7 +29,7 @@ class CartoonNetworkIE(TurnerBaseIE): title = self._html_search_regex(r'[^>]+.episodeTitle = "(.+?)"', webpage, 'title') auth = self._html_search_regex(r'[^>]+.authType = "(.+?)"', webpage, 'authType') if "unauth" in auth: - auth_required = 'false' + auth_required = '' if "auth" in auth: auth_required = 'true' videoType = self._html_search_regex(r'[^>]+.videoType = "(.+?)"', webpage, 'videoType') From dfd8f364728c47ed514e32deb739a264bc5f2966 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Tue, 4 Sep 2018 19:24:34 -0700 Subject: [PATCH 11/20] my my let's try again. --- youtube_dl/extractor/cartoonnetwork.py | 28 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 60b96a34f..c66ec4e47 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -28,24 +28,30 @@ class CartoonNetworkIE(TurnerBaseIE): video_id = self._html_search_regex(r'[^>]+.mediaId = "(.+?)"', webpage, 'video_id') title = self._html_search_regex(r'[^>]+.episodeTitle = "(.+?)"', webpage, 'title') auth = self._html_search_regex(r'[^>]+.authType = "(.+?)"', webpage, 'authType') - if "unauth" in auth: - auth_required = '' - if "auth" in auth: - auth_required = 'true' videoType = self._html_search_regex(r'[^>]+.videoType = "(.+?)"', webpage, 'videoType') if 'short' in videoType: description = '' else: description = self._html_search_regex(r'id="[^>]+description[^>]*>(.+?)
', webpage, 'description') - info = self._extract_ngtv_info( - video_id, - {'networkId': 'cartoonnetwork'}, - { + if "auth" in auth: + info = self._extract_ngtv_info( + video_id, + {'networkId': 'cartoonnetwork'}, + { 'url': url, 'site_name': 'CartoonNetwork', - 'auth_required': auth_required, - }, - ) + 'auth_required': 'true', + }, + ) + if "unauth" in auth: + info = self._extract_ngtv_info( + video_id, + {'networkId': 'cartoonnetwork'}, + { + 'url': url, + 'site_name': 'CartoonNetwork', + }, + ) info.update({ 'id': video_id, 'title': title, From c17af258168bc75dc283265c675f286256ff7a0c Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Wed, 5 Sep 2018 17:59:56 -0700 Subject: [PATCH 12/20] I think I got it now lol --- youtube_dl/extractor/cartoonnetwork.py | 28 ++++++++++---------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index c66ec4e47..ed035b1df 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -28,30 +28,24 @@ class CartoonNetworkIE(TurnerBaseIE): video_id = self._html_search_regex(r'[^>]+.mediaId = "(.+?)"', webpage, 'video_id') title = self._html_search_regex(r'[^>]+.episodeTitle = "(.+?)"', webpage, 'title') auth = self._html_search_regex(r'[^>]+.authType = "(.+?)"', webpage, 'authType') + if "auth" in auth: + auth_required = '' + if "unauth" in auth: + auth_required = 'true' #Auth needs to be first due to Auth being in unauth. :/ videoType = self._html_search_regex(r'[^>]+.videoType = "(.+?)"', webpage, 'videoType') if 'short' in videoType: description = '' else: description = self._html_search_regex(r'id="[^>]+description[^>]*>(.+?)', webpage, 'description') - if "auth" in auth: - info = self._extract_ngtv_info( - video_id, - {'networkId': 'cartoonnetwork'}, - { + info = self._extract_ngtv_info( + video_id, + {'networkId': 'cartoonnetwork'}, + { 'url': url, 'site_name': 'CartoonNetwork', - 'auth_required': 'true', - }, - ) - if "unauth" in auth: - info = self._extract_ngtv_info( - video_id, - {'networkId': 'cartoonnetwork'}, - { - 'url': url, - 'site_name': 'CartoonNetwork', - }, - ) + 'auth_required': auth_required, + }, + ) info.update({ 'id': video_id, 'title': title, From 3903434dc264c8153e213705c59416f1457e8340 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Fri, 7 Sep 2018 15:07:21 -0700 Subject: [PATCH 13/20] Update cartoonnetwork.py --- youtube_dl/extractor/cartoonnetwork.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index ed035b1df..89af448cd 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -27,11 +27,12 @@ class CartoonNetworkIE(TurnerBaseIE): webpage = self._download_webpage(url, display_id) video_id = self._html_search_regex(r'[^>]+.mediaId = "(.+?)"', webpage, 'video_id') title = self._html_search_regex(r'[^>]+.episodeTitle = "(.+?)"', webpage, 'title') - auth = self._html_search_regex(r'[^>]+.authType = "(.+?)"', webpage, 'authType') + auth = self._html_search_regex(r'[^>]+currentVideo.authType = "(.+?)"', webpage, 'authType') if "auth" in auth: auth_required = '' if "unauth" in auth: auth_required = 'true' #Auth needs to be first due to Auth being in unauth. :/ + //print(auth_required) videoType = self._html_search_regex(r'[^>]+.videoType = "(.+?)"', webpage, 'videoType') if 'short' in videoType: description = '' From 3b65a845f1a36ef8b1d3bb83ac8090171e69c798 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Fri, 7 Sep 2018 15:07:59 -0700 Subject: [PATCH 14/20] Update cartoonnetwork.py --- youtube_dl/extractor/cartoonnetwork.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 89af448cd..1cfe95184 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -32,7 +32,7 @@ class CartoonNetworkIE(TurnerBaseIE): auth_required = '' if "unauth" in auth: auth_required = 'true' #Auth needs to be first due to Auth being in unauth. :/ - //print(auth_required) + #print(auth_required) videoType = self._html_search_regex(r'[^>]+.videoType = "(.+?)"', webpage, 'videoType') if 'short' in videoType: description = '' From ea41ca233622363898a603975b9815414232e50f Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Fri, 7 Sep 2018 15:12:31 -0700 Subject: [PATCH 15/20] Update cartoonnetwork.py --- youtube_dl/extractor/cartoonnetwork.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 1cfe95184..e4e16b3cb 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -29,9 +29,9 @@ class CartoonNetworkIE(TurnerBaseIE): title = self._html_search_regex(r'[^>]+.episodeTitle = "(.+?)"', webpage, 'title') auth = self._html_search_regex(r'[^>]+currentVideo.authType = "(.+?)"', webpage, 'authType') if "auth" in auth: - auth_required = '' + auth_required = 'true' if "unauth" in auth: - auth_required = 'true' #Auth needs to be first due to Auth being in unauth. :/ + auth_required = '' #Auth needs to be first due to Auth being in unauth. :/ #print(auth_required) videoType = self._html_search_regex(r'[^>]+.videoType = "(.+?)"', webpage, 'videoType') if 'short' in videoType: From f4dde36bf93f37f39e85a4279714ee87a8e4fa9c Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Sun, 9 Sep 2018 13:26:10 -0700 Subject: [PATCH 16/20] [CartoonNetwork] Cleaned up some of the code. --- youtube_dl/extractor/cartoonnetwork.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index e4e16b3cb..2b098c68f 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -32,12 +32,8 @@ class CartoonNetworkIE(TurnerBaseIE): auth_required = 'true' if "unauth" in auth: auth_required = '' #Auth needs to be first due to Auth being in unauth. :/ - #print(auth_required) videoType = self._html_search_regex(r'[^>]+.videoType = "(.+?)"', webpage, 'videoType') - if 'short' in videoType: - description = '' - else: - description = self._html_search_regex(r'id="[^>]+description[^>]*>(.+?)', webpage, 'description') + description = self._html_search_regex(r'id="[^>]+description[^>]*>(.+?)', webpage, 'description', default=None) info = self._extract_ngtv_info( video_id, {'networkId': 'cartoonnetwork'}, From 2f165c999a588773124d117e4ab8874ba1649d49 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Tue, 11 Sep 2018 15:38:19 -0700 Subject: [PATCH 17/20] Cleaned up all of the code. Changed auth around so you don't need to use if statements and more. :/ --- youtube_dl/extractor/cartoonnetwork.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 2b098c68f..4529530bd 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -26,21 +26,18 @@ class CartoonNetworkIE(TurnerBaseIE): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) video_id = self._html_search_regex(r'[^>]+.mediaId = "(.+?)"', webpage, 'video_id') - title = self._html_search_regex(r'[^>]+.episodeTitle = "(.+?)"', webpage, 'title') - auth = self._html_search_regex(r'[^>]+currentVideo.authType = "(.+?)"', webpage, 'authType') - if "auth" in auth: - 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[^>]*>(.+?)', webpage, 'description', default=None) + title = self._html_search_regex(r'[^>]+.episodeTitle[^>]*"(.+?)"', webpage, 'title') + description = self._html_search_regex(r'[^>]+description[^>]*>(.+?)<', webpage, 'description', default=None) + print(video_id) info = self._extract_ngtv_info( video_id, {'networkId': 'cartoonnetwork'}, { 'url': url, '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({ From e52e66983afc417a873210a32bce4a7e93cede96 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Tue, 11 Sep 2018 15:38:59 -0700 Subject: [PATCH 18/20] Removed something I forgot to remove lol --- youtube_dl/extractor/cartoonnetwork.py | 1 - 1 file changed, 1 deletion(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 4529530bd..844eb532e 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -28,7 +28,6 @@ class CartoonNetworkIE(TurnerBaseIE): video_id = self._html_search_regex(r'[^>]+.mediaId = "(.+?)"', webpage, 'video_id') title = self._html_search_regex(r'[^>]+.episodeTitle[^>]*"(.+?)"', webpage, 'title') description = self._html_search_regex(r'[^>]+description[^>]*>(.+?)<', webpage, 'description', default=None) - print(video_id) info = self._extract_ngtv_info( video_id, {'networkId': 'cartoonnetwork'}, From af585dcd44ce8cb2fc77d7fe2152dc8055e13f51 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Tue, 11 Sep 2018 15:52:10 -0700 Subject: [PATCH 19/20] Changed something since title was something else. --- youtube_dl/extractor/cartoonnetwork.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index 844eb532e..d8eadf63e 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -26,7 +26,7 @@ class CartoonNetworkIE(TurnerBaseIE): display_id = self._match_id(url) webpage = self._download_webpage(url, display_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') description = self._html_search_regex(r'[^>]+description[^>]*>(.+?)<', webpage, 'description', default=None) info = self._extract_ngtv_info( video_id, From 5a2bc711d62e01e05fce1aa238d6dc2c6135e063 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Fri, 11 Jan 2019 20:59:42 -0800 Subject: [PATCH 20/20] Adding More Types! --- youtube_dl/extractor/cartoonnetwork.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/youtube_dl/extractor/cartoonnetwork.py b/youtube_dl/extractor/cartoonnetwork.py index d8eadf63e..ab6bee670 100644 --- a/youtube_dl/extractor/cartoonnetwork.py +++ b/youtube_dl/extractor/cartoonnetwork.py @@ -5,6 +5,9 @@ import re from .turner import TurnerBaseIE +from ..utils import ( + int_or_none, +) class CartoonNetworkIE(TurnerBaseIE): _VALID_URL = r'https?://(?:www\.)?cartoonnetwork\.com/video/(?:[^/]+/)+(?P[^/?#]+)-(?:clip|episode)\.html' @@ -28,6 +31,10 @@ class CartoonNetworkIE(TurnerBaseIE): video_id = self._html_search_regex(r'[^>]+.mediaId = "(.+?)"', webpage, 'video_id') title = self._html_search_regex(r'[^>]+.episodeTitle = "(.+?)"', webpage, 'title') description = self._html_search_regex(r'[^>]+description[^>]*>(.+?)<', webpage, 'description', default=None) + propertyName = self._html_search_regex(r'[^>]+.propertyName = "(.+?)"', webpage, 'propertyName', default=None) + seriesId = self._html_search_regex(r'[^>]+.seriesId = "(.+?)"', webpage, 'seriesId', default=None) + seasonNumber = self._html_search_regex(r'[^>]+.seasonNumber = "(.+?)"', webpage, 'seasonNumber', default=None) + episodeNumber = self._html_search_regex(r'[^>]+.episodeNumber = "(.+?)"', webpage, 'episodeNumber', default=None) info = self._extract_ngtv_info( video_id, {'networkId': 'cartoonnetwork'}, @@ -43,5 +50,9 @@ class CartoonNetworkIE(TurnerBaseIE): 'id': video_id, 'title': title, 'description': description, + 'series': propertyName, + 'season_number': int_or_none(seasonNumber), + 'season_id': int_or_none(seriesId), + 'episode_number': int_or_none(episodeNumber), }) return info