From c12977bdc455883e7061c2275da093c5b419a32a Mon Sep 17 00:00:00 2001 From: Sipherdrakon <64430430+Sipherdrakon@users.noreply.github.com> Date: Wed, 22 Sep 2021 10:09:45 -0400 Subject: [PATCH] [AnimalPlanet] Fix extractor (#1050) Authored by: Sipherdrakon --- yt_dlp/extractor/dplay.py | 22 +++++++++++++++++++++- yt_dlp/extractor/extractors.py | 3 ++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/dplay.py b/yt_dlp/extractor/dplay.py index f2aca4d67..e0e446b87 100644 --- a/yt_dlp/extractor/dplay.py +++ b/yt_dlp/extractor/dplay.py @@ -349,7 +349,7 @@ class DiscoveryPlusIE(DPlayIE): _API_URL = 'us1-prod-direct.discoveryplus.com' def _update_disco_api_headers(self, headers, disco_base, display_id, realm): - headers['x-disco-client'] = f'WEB:UNKNOWN:{self._PRODUCT}:15.0.0' + headers['x-disco-client'] = f'WEB:UNKNOWN:{self._PRODUCT}:25.2.6' def _download_video_playback_info(self, disco_base, video_id, headers): return self._download_json( @@ -409,3 +409,23 @@ class DIYNetworkIE(DiscoveryPlusIE): _PRODUCT = 'diy' _API_URL = 'us1-prod-direct.watch.diynetwork.com' + + +class AnimalPlanetIE(DiscoveryPlusIE): + _VALID_URL = r'https?://(?:www\.)?animalplanet\.com/video' + DPlayIE._PATH_REGEX + _TESTS = [{ + 'url': 'https://www.animalplanet.com/video/north-woods-law-animal-planet/squirrel-showdown', + 'info_dict': { + 'id': '3338923', + 'display_id': 'north-woods-law-animal-planet/squirrel-showdown', + 'ext': 'mp4', + 'title': 'Squirrel Showdown', + 'description': 'A woman is suspected of being in possession of flying squirrel kits.', + 'season_number': 16, + 'episode_number': 11, + }, + 'skip': 'Available for Premium users', + }] + + _PRODUCT = 'apl' + _API_URL = 'us1-prod-direct.animalplanet.com' diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py index 10581a71b..468fefbf1 100644 --- a/yt_dlp/extractor/extractors.py +++ b/yt_dlp/extractor/extractors.py @@ -346,7 +346,8 @@ from .dplay import ( DiscoveryPlusIE, HGTVDeIE, ScienceChannelIE, - DIYNetworkIE + DIYNetworkIE, + AnimalPlanetIE ) from .dreisat import DreiSatIE from .drbonanza import DRBonanzaIE