aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-09-12 21:34:45 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-09-12 21:40:37 +0530
commitad226b1dc9763fd2840514e7636a9e16ecc31f9d (patch)
treed0573444a788f918f1457efdd6d22151759992fd
parentca46b941349c0b5ab183320182fc61af28c70c45 (diff)
downloadhypervideo-pre-ad226b1dc9763fd2840514e7636a9e16ecc31f9d.tar.lz
hypervideo-pre-ad226b1dc9763fd2840514e7636a9e16ecc31f9d.tar.xz
hypervideo-pre-ad226b1dc9763fd2840514e7636a9e16ecc31f9d.zip
[funimation] Fix for locations outside US
Closes #868 Authored by: Jules-A, pukkandan
-rw-r--r--yt_dlp/extractor/funimation.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/yt_dlp/extractor/funimation.py b/yt_dlp/extractor/funimation.py
index 4d95f1c7c..584688484 100644
--- a/yt_dlp/extractor/funimation.py
+++ b/yt_dlp/extractor/funimation.py
@@ -302,12 +302,20 @@ class FunimationShowIE(FunimationIE):
},
}]
+ def _real_initialize(self):
+ region = self._get_cookies('https://www.funimation.com').get('region')
+ self._region = region.value if region else try_get(
+ self._download_json(
+ 'https://geo-service.prd.funimationsvc.com/geo/v1/region/check', None, fatal=False,
+ note='Checking geo-location', errnote='Unable to fetch geo-location information'),
+ lambda x: x['region']) or 'US'
+
def _real_extract(self, url):
base_url, locale, display_id = self._match_valid_url(url).groups()
show_info = self._download_json(
- 'https://title-api.prd.funimationsvc.com/v2/shows/%s?region=US&deviceType=web&locale=%s'
- % (display_id, locale or 'en'), display_id)
+ 'https://title-api.prd.funimationsvc.com/v2/shows/%s?region=%s&deviceType=web&locale=%s'
+ % (display_id, self._region, locale or 'en'), display_id)
items = self._download_json(
'https://prod-api-funimationnow.dadcdigital.com/api/funimation/episodes/?limit=99999&title_id=%s'
% show_info.get('id'), display_id).get('items')