aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammad Khaled AbouElSherbini <50295916+MKSherbini@users.noreply.github.com>2021-09-18 13:33:06 +0200
committerGitHub <noreply@github.com>2021-09-18 17:03:06 +0530
commit7738bd32722154a26f70006e0fe586f40d06e606 (patch)
treef0e2e6b11f8ffe6ebf185d75b6fc6d2fc77bb569
parent7c37ff97d3b95444ece7e7da2da6f03293003df3 (diff)
downloadhypervideo-pre-7738bd32722154a26f70006e0fe586f40d06e606.tar.lz
hypervideo-pre-7738bd32722154a26f70006e0fe586f40d06e606.tar.xz
hypervideo-pre-7738bd32722154a26f70006e0fe586f40d06e606.zip
[Oreilly] Handle new web url (#990)
The change in URL is most likely a server side issue. But we can work around it by a simple substitution Authored by: MKSherbini
-rw-r--r--yt_dlp/extractor/safari.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/yt_dlp/extractor/safari.py b/yt_dlp/extractor/safari.py
index c92e8849b..fbbbc7e77 100644
--- a/yt_dlp/extractor/safari.py
+++ b/yt_dlp/extractor/safari.py
@@ -193,7 +193,12 @@ class SafariApiIE(SafariBaseIE):
part = self._download_json(
url, '%s/%s' % (mobj.group('course_id'), mobj.group('part')),
'Downloading part JSON')
- return self.url_result(part['web_url'], SafariIE.ie_key())
+ web_url = part['web_url']
+ if 'library/view' in web_url:
+ web_url = web_url.replace('library/view', 'videos')
+ natural_keys = part['natural_key']
+ web_url = f'{web_url.rsplit("/")[0]}/{natural_keys[0]}-{natural_keys[1][:-5]}'
+ return self.url_result(web_url, SafariIE.ie_key())
class SafariCourseIE(SafariBaseIE):