From 89a11969782736722f321e90db865341a893f393 Mon Sep 17 00:00:00 2001 From: amd64fox <62529699+amd64fox@users.noreply.github.com> Date: Sun, 14 May 2023 13:25:44 +0300 Subject: [PATCH] Migration to Python - Multithreaded mode has been added for faster searching - Added search options: "Win-32", "Win-ARM64", "OSX", "OSX-ARM64" or search all at once. --- GUI/LoaderSpot_Gui.bat | 4 - GUI/LoaderSpot_Gui_Ru.bat | 4 - LoaderSpot.py | 129 +++++++++++++++++++++++ README.md | 45 ++------ LoaderSpot.ps1 => archive/LoaderSpot.ps1 | 90 ++++++++-------- {GUI => archive}/LoaderSpot_Gui.ps1 | 0 {GUI => archive}/LoaderSpot_Gui_Ru.ps1 | 0 7 files changed, 183 insertions(+), 89 deletions(-) delete mode 100644 GUI/LoaderSpot_Gui.bat delete mode 100644 GUI/LoaderSpot_Gui_Ru.bat create mode 100644 LoaderSpot.py rename LoaderSpot.ps1 => archive/LoaderSpot.ps1 (96%) rename {GUI => archive}/LoaderSpot_Gui.ps1 (100%) rename {GUI => archive}/LoaderSpot_Gui_Ru.ps1 (100%) diff --git a/GUI/LoaderSpot_Gui.bat b/GUI/LoaderSpot_Gui.bat deleted file mode 100644 index a371b13..0000000 --- a/GUI/LoaderSpot_Gui.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}"; "& {Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/LoaderSpot/main/GUI/LoaderSpot_Gui.ps1' | Invoke-Expression}" -pause -exit \ No newline at end of file diff --git a/GUI/LoaderSpot_Gui_Ru.bat b/GUI/LoaderSpot_Gui_Ru.bat deleted file mode 100644 index 6f23eaa..0000000 --- a/GUI/LoaderSpot_Gui_Ru.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}"; "& {(Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/LoaderSpot/main/GUI/LoaderSpot_Gui_Ru.ps1').Content | Invoke-Expression}" -pause -exit \ No newline at end of file diff --git a/LoaderSpot.py b/LoaderSpot.py new file mode 100644 index 0000000..27f04b0 --- /dev/null +++ b/LoaderSpot.py @@ -0,0 +1,129 @@ +import re +import requests +from concurrent.futures import ThreadPoolExecutor + + +def check_url(url, platform_name): + try: + response = requests.get(url) + if response.status_code == 200: + if platform_name: + return response.url, platform_name + else: + return response.url + else: + print(f"\nInvalid link: {url}") + response.close() + except requests.exceptions.RequestException: + pass + return None + + +version_spoti = "" +while not re.match(r"^\d+\.\d+\.\d+\.\d+\.g[0-9a-f]{8}$", version_spoti): + version_spoti = input("Spotify version, for example 1.1.68.632.g2b11de83: ") + +start_number = "" +while not start_number.isdigit() or not 0 <= int(start_number) <= 20000: + start_number = input("Start search from: ") + +before_enter = "" +while not before_enter.isdigit() or not 1 <= int(before_enter) <= 20000: + before_enter = input("End search at: ") + +max_workers_req = "" +while True: + max_workers_req = input("Number of threads: ") + try: + max_workers = int(max_workers_req) + if 1 <= max_workers <= 150: + break + else: + print("Value should be in the range from 1 to 150") + except ValueError: + print("Invalid value, please enter an integer") + +numbers = int(start_number) +find_url = [] + +win32 = "https://upgrade.scdn.co/upgrade/client/win32-x86/spotify_installer-{version_spoti}-{numbers}.exe" +win_arm64 = "https://upgrade.scdn.co/upgrade/client/win32-arm64/spotify_installer-{version_spoti}-{numbers}.exe" +osx = "https://upgrade.scdn.co/upgrade/client/osx-x86_64/spotify-autoupdate-{version_spoti}-{numbers}.tbz" +osx_arm64 = "https://upgrade.scdn.co/upgrade/client/osx-arm64/spotify-autoupdate-{version_spoti}-{numbers}.tbz" + +print("Select the link type for the search:") +print("[1] WIN32") +print("[2] WIN-ARM64") +print("[3] OSX") +print("[4] OSX-ARM64") +print("[5] ALL") + +choice = None +while choice not in ["1", "2", "3", "4", "5"]: + choice = input("Enter the number: ") + + if choice == "1": + url_template = win32 + platform_name = "WIN32" + elif choice == "2": + url_template = win_arm64 + platform_name = "WIN-ARM64" + elif choice == "3": + url_template = osx + platform_name = "OSX" + elif choice == "4": + url_template = osx_arm64 + platform_name = "OSX-ARM64" + elif choice == "5": + url_templates = [win32, win_arm64, osx, osx_arm64] + platform_names = ["WIN32", "WIN-ARM64", "OSX", "OSX-ARM64"] + else: + print("Value should be in the range from 1 to 5") + +print("Searching...") + +with ThreadPoolExecutor(max_workers=max_workers) as executor: + tasks = [] + + if choice == "5": + for url_template, platform_name in zip(url_templates, platform_names): + numbers = int(start_number) + while numbers <= int(before_enter): + url = url_template.format(version_spoti=version_spoti, numbers=numbers) + tasks.append(executor.submit(check_url, url, platform_name)) + numbers += 1 + else: + while numbers <= int(before_enter): + url = url_template.format(version_spoti=version_spoti, numbers=numbers) + tasks.append(executor.submit(check_url, url, platform_name)) + numbers += 1 + + for task in tasks: + result = task.result() + if result is not None: + find_url.append(result) + +print("\nSearch completed.\n") +if find_url: + platform_urls = {} + for item in find_url: + if isinstance(item, tuple): + url, platform_name = item + if platform_name not in platform_urls: + platform_urls[platform_name] = [] + platform_urls[platform_name].append(url) + else: + if "Unknown" not in platform_urls: + platform_urls["Unknown"] = [] + platform_urls["Unknown"].append(item) + + for platform_name, urls in platform_urls.items(): + print(f"{platform_name}:") + for url in urls: + print(url) + print() +else: + print("Nothing found, consider increasing the search range.") + +print("\n") +input("Press Enter to exit") diff --git a/README.md b/README.md index 8a96571..f560e29 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,9 @@ -

- - - -

- - - - - - - -
-

LoaderSpot -

-

A tool for downloading the full Spotify Windows Desktop client.

- - -- To download the version you need, you need to find out its full name, for example, you can find it [here](https://www.spotify.com/us/opensource) -- The version found should look something like this: 1.1.68.632.g2b11de83 -- Download and run - - [LoaderSpot.bat](https://cutt.ly/pEvhtdr) - - [LoaderSpot_Gui.bat](https://cutt.ly/9FbGCtv) - - [LoaderSpot_Gui_Ru.bat](https://cutt.ly/UFbG7XG) -- Follow the further instructions on the screen - - - * * * - -
-

I also created an updatable document, with all the links I found. You can see it here

- - +

+ +

+

LoaderSpot

+

A tool for downloading the full Spotify Desktop client.

+

+

I also created an updatable document, with all the links I found. You can see it here

+

+

Thanks for the idea nick-botticelli

\ No newline at end of file diff --git a/LoaderSpot.ps1 b/archive/LoaderSpot.ps1 similarity index 96% rename from LoaderSpot.ps1 rename to archive/LoaderSpot.ps1 index d410294..d504923 100644 --- a/LoaderSpot.ps1 +++ b/archive/LoaderSpot.ps1 @@ -1,45 +1,45 @@ -do { $version_spoti = Read-Host -Prompt "Enter the Spotify version, for example 1.1.68.632.g2b11de83" } -while ($version_spoti -notmatch '^\d.\d.\d{1,2}.\d{1,5}.[a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z]$') - -do { $before_enter = Read-Host -Prompt "Enter the number to stop at (e.g. 99)" } -while ($before_enter -notmatch '^\d{1,4}$') - -$numbers = 0 - -"Search..." -While ($numbers -le $before_enter) { - - $_URL = "https://upgrade.scdn.co/upgrade/client/win32-x86/spotify_installer-$version_spoti-$numbers.exe" - - - try { - $request = [System.Net.WebRequest]::Create($_URL) - $response = $request.getResponse() - - if ($response.StatusCode -eq "200") { - $response.ResponseUri.OriginalString - $find_url += [System.Environment]::NewLine + $response.ResponseUri.OriginalString - $response.Close() - } - - } - catch { - $numbers - } - - $numbers++ -} - -write-host "`n" -"Search completed" -write-host "`n" -if ($find_url) { - "Found links :" - $find_url -} -if (!($find_url)) { - "Nothing found, please increase your search range." -} -write-host "`n" -pause -exit +do { $version_spoti = Read-Host -Prompt "Enter the Spotify version, for example 1.1.68.632.g2b11de83" } +while ($version_spoti -notmatch '^\d.\d.\d{1,2}.\d{1,5}.[a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z][0-9a-z]$') + +do { $before_enter = Read-Host -Prompt "Enter the number to stop at (e.g. 99)" } +while ($before_enter -notmatch '^\d{1,4}$') + +$numbers = 0 + +"Search..." +While ($numbers -le $before_enter) { + + $_URL = "https://upgrade.scdn.co/upgrade/client/win32-x86/spotify_installer-$version_spoti-$numbers.exe" + + + try { + $request = [System.Net.WebRequest]::Create($_URL) + $response = $request.getResponse() + + if ($response.StatusCode -eq "200") { + $response.ResponseUri.OriginalString + $find_url += [System.Environment]::NewLine + $response.ResponseUri.OriginalString + $response.Close() + } + + } + catch { + $numbers + } + + $numbers++ +} + +write-host "`n" +"Search completed" +write-host "`n" +if ($find_url) { + "Found links :" + $find_url +} +if (!($find_url)) { + "Nothing found, please increase your search range." +} +write-host "`n" +pause +exit diff --git a/GUI/LoaderSpot_Gui.ps1 b/archive/LoaderSpot_Gui.ps1 similarity index 100% rename from GUI/LoaderSpot_Gui.ps1 rename to archive/LoaderSpot_Gui.ps1 diff --git a/GUI/LoaderSpot_Gui_Ru.ps1 b/archive/LoaderSpot_Gui_Ru.ps1 similarity index 100% rename from GUI/LoaderSpot_Gui_Ru.ps1 rename to archive/LoaderSpot_Gui_Ru.ps1