Skip to content

Commit

Permalink
Migration to Python
Browse files Browse the repository at this point in the history
- Multithreaded mode has been added for faster searching
- Added search options: "Win-32", "Win-ARM64", "OSX", "OSX-ARM64" or search all at once.
  • Loading branch information
amd64fox committed May 14, 2023
1 parent 33b35d4 commit 89a1196
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 89 deletions.
4 changes: 0 additions & 4 deletions GUI/LoaderSpot_Gui.bat

This file was deleted.

4 changes: 0 additions & 4 deletions GUI/LoaderSpot_Gui_Ru.bat

This file was deleted.

129 changes: 129 additions & 0 deletions LoaderSpot.py
Original file line number Diff line number Diff line change
@@ -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")
45 changes: 9 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,9 @@
<p align="center">
<a href="https://t.me/amd64fox"><img src="https://img.shields.io/badge/%40Amd64fox-%40Amd64fox-blue.svg?style=flat&logo=telegram&label=Telegram"></a>
<a href="https://cutt.ly/8EH6NuH"><img src="https://img.shields.io/badge/Excel%20table--brightgreen.svg?style=flat&logo=microsoftexcel&label=Excel table"></a>
<a href="https://github.com/amd64fox/LoaderSpot/releases"><img src="https://img.shields.io/github/downloads/amd64fox/LoaderSpot/total.svg?style=flat&label=Total downloads"></a>
</p>






<center>
<h1 align="center">LoaderSpot
</h1>
<h2 align="center">A tool for downloading the full Spotify Windows Desktop client.</h4
</center>

- 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


* * *
<center>
<h3 align="center">I also created an updatable document, with all the links I found. You can see it <a href="https://cutt.ly/8EH6NuH">here</a></h4
</center>

<p align="center">
<a href="https://docs.google.com/spreadsheets/d/1wztO1L4zvNykBRw7X4jxP8pvo11oQjT0O5DvZ_-S4Ok/edit#gid=0"><img src="https://img.shields.io/badge/Excel%20table--brightgreen.svg?style=flat&logo=microsoftexcel&label=Excel table"></a>
</p>
<h1 align="center">LoaderSpot</h1>
<h2 align="center">A tool for downloading the full Spotify Desktop client.</h2>
<p align="center">
<h3 align="center">I also created an updatable document, with all the links I found. You can see it <a href="https://docs.google.com/spreadsheets/d/1wztO1L4zvNykBRw7X4jxP8pvo11oQjT0O5DvZ_-S4Ok/edit#gid=0">here</a></h3>
</p>
<p align="center">Thanks for the idea <a href="https://github.com/nick-botticelli/SpotifyUpgradeFinder">nick-botticelli</a></p>
90 changes: 45 additions & 45 deletions LoaderSpot.ps1 → archive/LoaderSpot.ps1
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.

0 comments on commit 89a1196

Please sign in to comment.