From 0b18b8691e7642027a85c47feb72f282ead7f675 Mon Sep 17 00:00:00 2001 From: kenavera Date: Sat, 31 Mar 2018 17:29:39 +0200 Subject: [PATCH 1/6] [nationalgeographic] Updated valid url regex --- youtube_dl/extractor/nationalgeographic.py | 38 +++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/nationalgeographic.py b/youtube_dl/extractor/nationalgeographic.py index 246f6795a..d5492c942 100644 --- a/youtube_dl/extractor/nationalgeographic.py +++ b/youtube_dl/extractor/nationalgeographic.py @@ -68,7 +68,7 @@ class NationalGeographicVideoIE(InfoExtractor): class NationalGeographicIE(ThePlatformIE, AdobePassIE): IE_NAME = 'natgeo' - _VALID_URL = r'https?://channel\.nationalgeographic\.com/(?:(?:wild/)?[^/]+/)?(?:videos|episodes)/(?P[^/?]+)' + _VALID_URL = r'https?://channel\.nationalgeographic\.com/(?:(?:(?:wild/)?[^/]+/)?(?:videos|episodes)|u)/(?P[^/?]+)' _TESTS = [ { @@ -85,6 +85,20 @@ class NationalGeographicIE(ThePlatformIE, AdobePassIE): }, 'add_ie': ['ThePlatform'], }, + { + 'url': 'http://channel.nationalgeographic.com/u/kdi9Ld0PN2molUUIMSBGxoeDhD729KRjQcnxtetilWPMevo8ZwUBIDuPR0Q3D2LVaTsk0MPRkRWDB8ZhqWVeyoxfsZZm36yRp1j-zPfsHEyI_EgAeFY/', + 'md5': '518c9aa655686cf81493af5cc21e2a04', + 'info_dict': { + 'id': 'vKInpacll2pC', + 'ext': 'mp4', + 'title': 'Uncovering a Universal Knowledge', + 'description': 'md5:1a89148475bf931b3661fcd6ddb2ae3a', + 'timestamp': 1458680907, + 'upload_date': '20160322', + 'uploader': 'NEWA-FNG-NGTV', + }, + 'add_ie': ['ThePlatform'], + }, { 'url': 'http://channel.nationalgeographic.com/wild/destination-wild/videos/the-stunning-red-bird-of-paradise/', 'md5': 'c4912f656b4cbe58f3e000c489360989', @@ -99,13 +113,35 @@ class NationalGeographicIE(ThePlatformIE, AdobePassIE): }, 'add_ie': ['ThePlatform'], }, + { + 'url': 'http://channel.nationalgeographic.com/u/kdvOstqYaBY-vSBPyYgAZRUL4sWUJ5XUUPEhc7ISyBHqoIO4_dzfY3K6EjHIC0hmFXoQ7Cpzm6RkET7S3oMlm6CFnrQwSUwo/', + 'md5': 'c4912f656b4cbe58f3e000c489360989', + 'info_dict': { + 'id': 'Pok5lWCkiEFA', + 'ext': 'mp4', + 'title': 'The Stunning Red Bird of Paradise', + 'description': 'md5:7bc8cd1da29686be4d17ad1230f0140c', + 'timestamp': 1459362152, + 'upload_date': '20160330', + 'uploader': 'NEWA-FNG-NGTV', + }, + 'add_ie': ['ThePlatform'], + }, { 'url': 'http://channel.nationalgeographic.com/the-story-of-god-with-morgan-freeman/episodes/the-power-of-miracles/', 'only_matching': True, }, + { + 'url': 'http://channel.nationalgeographic.com/u/kdi9Ld0PN2molUUIMSBGxoeDhD729KRjQcnxtetilWPMevo8ZwUSXkSTKeZRprWH4EnGTzTX5XvTLIf_ZJ84eqa9CkXL7ve9qquErlA/', + 'only_matching': True, + }, { 'url': 'http://channel.nationalgeographic.com/videos/treasures-rediscovered/', 'only_matching': True, + }, + { + 'url': 'http://channel.nationalgeographic.com/u/kdpkrVDqVLq3UmWBm6HFX3ZlQR7Mxof8CYI8cN88MvXkTJviZipx/', + 'only_matching': True, } ] From 1155dbf5ba549ca34c3d9d6a4cde2bd6b8541e12 Mon Sep 17 00:00:00 2001 From: kenavera Date: Sun, 1 Apr 2018 11:09:46 +0200 Subject: [PATCH 2/6] Corrected tests --- youtube_dl/extractor/nationalgeographic.py | 36 +++++----------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/youtube_dl/extractor/nationalgeographic.py b/youtube_dl/extractor/nationalgeographic.py index d5492c942..8b686af81 100644 --- a/youtube_dl/extractor/nationalgeographic.py +++ b/youtube_dl/extractor/nationalgeographic.py @@ -85,20 +85,6 @@ class NationalGeographicIE(ThePlatformIE, AdobePassIE): }, 'add_ie': ['ThePlatform'], }, - { - 'url': 'http://channel.nationalgeographic.com/u/kdi9Ld0PN2molUUIMSBGxoeDhD729KRjQcnxtetilWPMevo8ZwUBIDuPR0Q3D2LVaTsk0MPRkRWDB8ZhqWVeyoxfsZZm36yRp1j-zPfsHEyI_EgAeFY/', - 'md5': '518c9aa655686cf81493af5cc21e2a04', - 'info_dict': { - 'id': 'vKInpacll2pC', - 'ext': 'mp4', - 'title': 'Uncovering a Universal Knowledge', - 'description': 'md5:1a89148475bf931b3661fcd6ddb2ae3a', - 'timestamp': 1458680907, - 'upload_date': '20160322', - 'uploader': 'NEWA-FNG-NGTV', - }, - 'add_ie': ['ThePlatform'], - }, { 'url': 'http://channel.nationalgeographic.com/wild/destination-wild/videos/the-stunning-red-bird-of-paradise/', 'md5': 'c4912f656b4cbe58f3e000c489360989', @@ -114,15 +100,15 @@ class NationalGeographicIE(ThePlatformIE, AdobePassIE): 'add_ie': ['ThePlatform'], }, { - 'url': 'http://channel.nationalgeographic.com/u/kdvOstqYaBY-vSBPyYgAZRUL4sWUJ5XUUPEhc7ISyBHqoIO4_dzfY3K6EjHIC0hmFXoQ7Cpzm6RkET7S3oMlm6CFnrQwSUwo/', - 'md5': 'c4912f656b4cbe58f3e000c489360989', + 'url': 'http://channel.nationalgeographic.com/u/kcOIVhcWjca1n65QtmFg_5vIMZ9j1S1CXT46o65HkAANx6SUvJvQAQfYjGC0CkQwGNSgnX54f2aoFg/', + 'md5': '8727ce6610e8d54dfa523ec8dbc12d02', 'info_dict': { - 'id': 'Pok5lWCkiEFA', + 'id': '7U3oHGsUo9DI', 'ext': 'mp4', - 'title': 'The Stunning Red Bird of Paradise', - 'description': 'md5:7bc8cd1da29686be4d17ad1230f0140c', - 'timestamp': 1459362152, - 'upload_date': '20160330', + 'title': 'One Strange Rock Trailer', + 'description': 'md5:27c87bc04f2f1c41dd49a4456175c1ec', + 'timestamp': 1519162181, + 'upload_date': '20180220', 'uploader': 'NEWA-FNG-NGTV', }, 'add_ie': ['ThePlatform'], @@ -131,17 +117,9 @@ class NationalGeographicIE(ThePlatformIE, AdobePassIE): 'url': 'http://channel.nationalgeographic.com/the-story-of-god-with-morgan-freeman/episodes/the-power-of-miracles/', 'only_matching': True, }, - { - 'url': 'http://channel.nationalgeographic.com/u/kdi9Ld0PN2molUUIMSBGxoeDhD729KRjQcnxtetilWPMevo8ZwUSXkSTKeZRprWH4EnGTzTX5XvTLIf_ZJ84eqa9CkXL7ve9qquErlA/', - 'only_matching': True, - }, { 'url': 'http://channel.nationalgeographic.com/videos/treasures-rediscovered/', 'only_matching': True, - }, - { - 'url': 'http://channel.nationalgeographic.com/u/kdpkrVDqVLq3UmWBm6HFX3ZlQR7Mxof8CYI8cN88MvXkTJviZipx/', - 'only_matching': True, } ] From 02fe81447a712b2b21888f3b088fc55ab139906d Mon Sep 17 00:00:00 2001 From: kenavera Date: Sun, 1 Apr 2018 11:33:23 +0200 Subject: [PATCH 3/6] Changed complete test to only_matching --- youtube_dl/extractor/nationalgeographic.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/youtube_dl/extractor/nationalgeographic.py b/youtube_dl/extractor/nationalgeographic.py index 8b686af81..acdfd0cb4 100644 --- a/youtube_dl/extractor/nationalgeographic.py +++ b/youtube_dl/extractor/nationalgeographic.py @@ -99,20 +99,6 @@ class NationalGeographicIE(ThePlatformIE, AdobePassIE): }, 'add_ie': ['ThePlatform'], }, - { - 'url': 'http://channel.nationalgeographic.com/u/kcOIVhcWjca1n65QtmFg_5vIMZ9j1S1CXT46o65HkAANx6SUvJvQAQfYjGC0CkQwGNSgnX54f2aoFg/', - 'md5': '8727ce6610e8d54dfa523ec8dbc12d02', - 'info_dict': { - 'id': '7U3oHGsUo9DI', - 'ext': 'mp4', - 'title': 'One Strange Rock Trailer', - 'description': 'md5:27c87bc04f2f1c41dd49a4456175c1ec', - 'timestamp': 1519162181, - 'upload_date': '20180220', - 'uploader': 'NEWA-FNG-NGTV', - }, - 'add_ie': ['ThePlatform'], - }, { 'url': 'http://channel.nationalgeographic.com/the-story-of-god-with-morgan-freeman/episodes/the-power-of-miracles/', 'only_matching': True, @@ -120,6 +106,10 @@ class NationalGeographicIE(ThePlatformIE, AdobePassIE): { 'url': 'http://channel.nationalgeographic.com/videos/treasures-rediscovered/', 'only_matching': True, + }, + { + 'url': 'http://channel.nationalgeographic.com/u/kcOIVhcWjca1n65QtmFg_5vIMZ9j1S1CXT46o65HkAANx6SUvJvQAQfYjGC0CkQwGNSgnX54f2aoFg/', + 'only_matching': True, } ] From f941b699c784e5e6c96acc32a71071053c4ba96a Mon Sep 17 00:00:00 2001 From: kenavera Date: Sun, 1 Apr 2018 11:42:18 +0200 Subject: [PATCH 4/6] Changed scheme of complete tests to new url format --- youtube_dl/extractor/nationalgeographic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/nationalgeographic.py b/youtube_dl/extractor/nationalgeographic.py index acdfd0cb4..5097bdb5b 100644 --- a/youtube_dl/extractor/nationalgeographic.py +++ b/youtube_dl/extractor/nationalgeographic.py @@ -72,7 +72,7 @@ class NationalGeographicIE(ThePlatformIE, AdobePassIE): _TESTS = [ { - 'url': 'http://channel.nationalgeographic.com/the-story-of-god-with-morgan-freeman/videos/uncovering-a-universal-knowledge/', + 'url': 'http://channel.nationalgeographic.com/u/kdi9Ld0PN2molUUIMSBGxoeDhD729KRjQcnxtetilWPMevo8ZwUBIDuPR0Q3D2LVaTsk0MPRkRWDB8ZhqWVeyoxfsZZm36yRp1j-zPfsHEyI_EgAeFY/', 'md5': '518c9aa655686cf81493af5cc21e2a04', 'info_dict': { 'id': 'vKInpacll2pC', @@ -86,7 +86,7 @@ class NationalGeographicIE(ThePlatformIE, AdobePassIE): 'add_ie': ['ThePlatform'], }, { - 'url': 'http://channel.nationalgeographic.com/wild/destination-wild/videos/the-stunning-red-bird-of-paradise/', + 'url': 'http://channel.nationalgeographic.com/u/kdvOstqYaBY-vSBPyYgAZRUL4sWUJ5XUUPEhc7ISyBHqoIO4_dzfY3K6EjHIC0hmFXoQ7Cpzm6RkET7S3oMlm6CFnrQwSUwo/', 'md5': 'c4912f656b4cbe58f3e000c489360989', 'info_dict': { 'id': 'Pok5lWCkiEFA', From 9be1f69124ebb90e13bfd8815281eaf3e1385ef9 Mon Sep 17 00:00:00 2001 From: kenavera Date: Sun, 1 Apr 2018 16:10:55 +0200 Subject: [PATCH 5/6] Added old urls to only_matching --- youtube_dl/extractor/nationalgeographic.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/youtube_dl/extractor/nationalgeographic.py b/youtube_dl/extractor/nationalgeographic.py index 5097bdb5b..c9fc86401 100644 --- a/youtube_dl/extractor/nationalgeographic.py +++ b/youtube_dl/extractor/nationalgeographic.py @@ -110,6 +110,14 @@ class NationalGeographicIE(ThePlatformIE, AdobePassIE): { 'url': 'http://channel.nationalgeographic.com/u/kcOIVhcWjca1n65QtmFg_5vIMZ9j1S1CXT46o65HkAANx6SUvJvQAQfYjGC0CkQwGNSgnX54f2aoFg/', 'only_matching': True, + }, + { + 'url': 'http://channel.nationalgeographic.com/the-story-of-god-with-morgan-freeman/videos/uncovering-a-universal-knowledge/', + 'only_matching': True, + }, + { + 'url': 'http://channel.nationalgeographic.com/wild/destination-wild/videos/the-stunning-red-bird-of-paradise/', + 'only_matching': True, } ] From 5ca6bf8a7235903bc8646a589b9cb0d8aeca563f Mon Sep 17 00:00:00 2001 From: Sergey M Date: Sun, 1 Apr 2018 21:16:56 +0700 Subject: [PATCH 6/6] Update nationalgeographic.py --- youtube_dl/extractor/nationalgeographic.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/youtube_dl/extractor/nationalgeographic.py b/youtube_dl/extractor/nationalgeographic.py index c9fc86401..4d2ee6408 100644 --- a/youtube_dl/extractor/nationalgeographic.py +++ b/youtube_dl/extractor/nationalgeographic.py @@ -107,10 +107,6 @@ class NationalGeographicIE(ThePlatformIE, AdobePassIE): 'url': 'http://channel.nationalgeographic.com/videos/treasures-rediscovered/', 'only_matching': True, }, - { - 'url': 'http://channel.nationalgeographic.com/u/kcOIVhcWjca1n65QtmFg_5vIMZ9j1S1CXT46o65HkAANx6SUvJvQAQfYjGC0CkQwGNSgnX54f2aoFg/', - 'only_matching': True, - }, { 'url': 'http://channel.nationalgeographic.com/the-story-of-god-with-morgan-freeman/videos/uncovering-a-universal-knowledge/', 'only_matching': True,