From 9bcbf721861d6165f783cc5323081262d7e22a7e Mon Sep 17 00:00:00 2001 From: borfirbora Date: Tue, 7 May 2024 21:43:19 +0300 Subject: [PATCH] downloading fixed --- addon/globalPlugins/basic_youtube_downloader/__init__.py | 8 +++++--- .../basic_youtube_downloader/pytube/cipher.py | 2 +- buildVars.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addon/globalPlugins/basic_youtube_downloader/__init__.py b/addon/globalPlugins/basic_youtube_downloader/__init__.py index e84885c..21b0124 100644 --- a/addon/globalPlugins/basic_youtube_downloader/__init__.py +++ b/addon/globalPlugins/basic_youtube_downloader/__init__.py @@ -56,7 +56,7 @@ def recogniseLink(self, link): elif "youtube.com/playlist?" in link: return pytube.Playlist(link) elif "youtu.be/" in link: - return pytube.YouTube("https://youtube.com/watch?v={}".format(parse.urlparse(link).path[1::])) + return pytube.YouTube("https://www.youtube.com/watch?v={}".format(parse.urlparse(link).path[1::])) else: gui.speech.speakMessage(_("It is not a valid link")) self.terminate() @@ -116,9 +116,11 @@ def downloadVideo(self, quality, video: pytube.YouTube, f_path): video.register_on_complete_callback(self.onComplete) video.register_on_progress_callback(self.onProgress) if quality == 0: - video.streams.get_highest_resolution().download(f_path) + d = video.streams.get_highest_resolution() + d.download(f_path) elif quality == 1: - video.streams.get_lowest_resolution().download(f_path) + d = video.streams.get_lowest_resolution() + d.download(f_path) self.clearGestureBindings() self.bindGestures(self._GlobalPlugin__gestures) diff --git a/addon/globalPlugins/basic_youtube_downloader/pytube/cipher.py b/addon/globalPlugins/basic_youtube_downloader/pytube/cipher.py index d385d83..5b37bad 100644 --- a/addon/globalPlugins/basic_youtube_downloader/pytube/cipher.py +++ b/addon/globalPlugins/basic_youtube_downloader/pytube/cipher.py @@ -27,7 +27,7 @@ class Cipher: def __init__(self, js: str): self.transform_plan: List[str] = get_transform_plan(js) - var_regex = re.compile(r"^\w+\W") + var_regex = re.compile(r"^\$*\w+\W") var_match = var_regex.search(self.transform_plan[0]) if not var_match: raise RegexMatchError( diff --git a/buildVars.py b/buildVars.py index 7c537a5..6f647c8 100644 --- a/buildVars.py +++ b/buildVars.py @@ -25,7 +25,7 @@ def _(arg): # Translators: Long description to be shown for this add-on on add-on information from add-ons manager "addon_description": _("A plugin that can download Youtube videos and playlists."), # version - "addon_version": "1.5", + "addon_version": "1.5.1", # Author(s) "addon_author": "Bora FIRLANGEƇ ", # URL for the add-on documentation support