added x64 for windows
- added x64 architecture for Windows - fixed sorting when displaying found architectures
This commit is contained in:
parent
594d9b4147
commit
3d0b5c4760
2 changed files with 51 additions and 37 deletions
|
|
@ -34,16 +34,18 @@ async def main(version_spoti=""):
|
|||
find_url = []
|
||||
|
||||
win32 = "https://upgrade.scdn.co/upgrade/client/win32-x86/spotify_installer-{version_spoti}-{numbers}.exe"
|
||||
win64 = "https://upgrade.scdn.co/upgrade/client/win32-x86_64/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("\nSelect the link type for the search:")
|
||||
print("[1] WIN32")
|
||||
print("[2] WIN-ARM64")
|
||||
print("[3] OSX")
|
||||
print("[4] OSX-ARM64")
|
||||
print("[5] All platforms")
|
||||
print("[2] WIN64")
|
||||
print("[3] WIN-ARM64")
|
||||
print("[4] OSX")
|
||||
print("[5] OSX-ARM64")
|
||||
print("[6] All platforms")
|
||||
|
||||
choices = []
|
||||
while not choices:
|
||||
|
|
@ -60,19 +62,21 @@ async def main(version_spoti=""):
|
|||
elif c == "4":
|
||||
choices.append("4")
|
||||
elif c == "5":
|
||||
choices = ["1", "2", "3", "4"]
|
||||
choices.append("5")
|
||||
elif c == "6":
|
||||
choices = ["1", "2", "3", "4", "5"]
|
||||
break
|
||||
else:
|
||||
print("Value should be in the range from 1 to 5")
|
||||
print("Value should be in the range from 1 to 6")
|
||||
|
||||
print("\nSearching...\n")
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
tasks = []
|
||||
|
||||
if "5" in choices:
|
||||
url_templates = [win32, win_arm64, osx, osx_arm64]
|
||||
platform_names = ["WIN32", "WIN-ARM64", "OSX", "OSX-ARM64"]
|
||||
if "6" in choices: # Updated condition to include option 6
|
||||
url_templates = [win32, win64, win_arm64, osx, osx_arm64]
|
||||
platform_names = ["WIN32", "WIN64", "WIN-ARM64", "OSX", "OSX-ARM64"]
|
||||
for url_template, platform_name in zip(url_templates, platform_names):
|
||||
numbers = int(start_number)
|
||||
while numbers <= int(before_enter):
|
||||
|
|
@ -87,12 +91,15 @@ async def main(version_spoti=""):
|
|||
url_template = win32
|
||||
platform_name = "WIN32"
|
||||
elif choice == "2":
|
||||
url_template = win64
|
||||
platform_name = "WIN64"
|
||||
elif choice == "3":
|
||||
url_template = win_arm64
|
||||
platform_name = "WIN-ARM64"
|
||||
elif choice == "3":
|
||||
elif choice == "4":
|
||||
url_template = osx
|
||||
platform_name = "OSX"
|
||||
elif choice == "4":
|
||||
elif choice == "5":
|
||||
url_template = osx_arm64
|
||||
platform_name = "OSX-ARM64"
|
||||
numbers = int(start_number)
|
||||
|
|
@ -124,11 +131,14 @@ async def main(version_spoti=""):
|
|||
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()
|
||||
sorting_order = ["WIN32", "WIN64", "WIN-ARM64", "OSX", "OSX-ARM64"]
|
||||
|
||||
for platform_name in sorting_order:
|
||||
if platform_name in platform_urls:
|
||||
print(f"{platform_name}:")
|
||||
for url in platform_urls[platform_name]:
|
||||
print(url)
|
||||
print()
|
||||
else:
|
||||
print("Nothing found, consider increasing the search range\n")
|
||||
|
||||
|
|
@ -150,4 +160,5 @@ async def main(version_spoti=""):
|
|||
else:
|
||||
print("Invalid choice. Exiting the code.")
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
45
upd.py
45
upd.py
|
|
@ -5,15 +5,16 @@ import argparse
|
|||
from bs4 import BeautifulSoup
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-v', required=True)
|
||||
parser.add_argument('-s', required=True)
|
||||
parser.add_argument('-u', required=True)
|
||||
parser.add_argument("-v", required=True)
|
||||
parser.add_argument("-s", required=True)
|
||||
parser.add_argument("-u", required=True)
|
||||
|
||||
args = parser.parse_args()
|
||||
version = args.v
|
||||
source = args.s
|
||||
u = args.u
|
||||
|
||||
|
||||
async def check_url(session, url, platform_name):
|
||||
try:
|
||||
async with session.get(url) as response:
|
||||
|
|
@ -26,18 +27,22 @@ async def check_url(session, url, platform_name):
|
|||
pass
|
||||
return None
|
||||
|
||||
|
||||
async def send_request(json_data):
|
||||
url = u + json_data
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(url) as response:
|
||||
if response.status == 200:
|
||||
data = await response.text()
|
||||
soup = BeautifulSoup(data, 'html.parser')
|
||||
system_response = soup.find('div', style='text-align:center;font-family:monospace;margin:50px auto 0;max-width:600px').text
|
||||
print(f'Ответ от Google apps script: {system_response}')
|
||||
soup = BeautifulSoup(data, "html.parser")
|
||||
system_response = soup.find(
|
||||
"div",
|
||||
style="text-align:center;font-family:monospace;margin:50px auto 0;max-width:600px",
|
||||
).text
|
||||
print(f"Ответ от Google apps script: {system_response}")
|
||||
|
||||
|
||||
async def main():
|
||||
|
||||
start_number = 0
|
||||
before_enter = 5500
|
||||
|
||||
|
|
@ -45,6 +50,7 @@ async def main():
|
|||
find_url = []
|
||||
|
||||
win32 = "https://upgrade.scdn.co/upgrade/client/win32-x86/spotify_installer-{version}-{numbers}.exe"
|
||||
win64 = "https://upgrade.scdn.co/upgrade/client/win32-x86_64/spotify_installer-{version_spoti}-{numbers}.exe"
|
||||
win_arm64 = "https://upgrade.scdn.co/upgrade/client/win32-arm64/spotify_installer-{version}-{numbers}.exe"
|
||||
osx = "https://upgrade.scdn.co/upgrade/client/osx-x86_64/spotify-autoupdate-{version}-{numbers}.tbz"
|
||||
osx_arm64 = "https://upgrade.scdn.co/upgrade/client/osx-arm64/spotify-autoupdate-{version}-{numbers}.tbz"
|
||||
|
|
@ -52,15 +58,13 @@ async def main():
|
|||
async with aiohttp.ClientSession() as session:
|
||||
tasks = []
|
||||
|
||||
url_templates = [win32, win_arm64, osx, osx_arm64]
|
||||
platform_names = ["WIN32", "WIN-ARM64", "OSX", "OSX-ARM64"]
|
||||
url_templates = [win32, win64, win_arm64, osx, osx_arm64]
|
||||
platform_names = ["WIN32", "WIN64", "WIN-ARM64", "OSX", "OSX-ARM64"]
|
||||
|
||||
for url_template, platform_name in zip(url_templates, platform_names):
|
||||
numbers = start_number
|
||||
while numbers <= before_enter:
|
||||
url = url_template.format(
|
||||
version=version, numbers=numbers
|
||||
)
|
||||
url = url_template.format(version=version, numbers=numbers)
|
||||
tasks.append(check_url(session, url, platform_name))
|
||||
numbers += 1
|
||||
|
||||
|
|
@ -76,21 +80,20 @@ async def main():
|
|||
if isinstance(item, tuple):
|
||||
url, platform_name = item
|
||||
if platform_name not in platform_urls:
|
||||
platform_urls[platform_name] = str(url) # Преобразование URL в строку
|
||||
platform_urls[platform_name] = str(
|
||||
url
|
||||
) # Преобразование URL в строку
|
||||
else:
|
||||
if "unknown" not in platform_urls:
|
||||
platform_urls["unknown"] = "unknown"
|
||||
platform_urls["version"] = version
|
||||
platform_urls["unknown"] = "unknown"
|
||||
platform_urls["version"] = version
|
||||
platform_urls["source"] = source
|
||||
req_ver = json.dumps(platform_urls)
|
||||
print(f'Версия {version} отправлена')
|
||||
print(f"Версия {version} отправлена")
|
||||
await send_request(req_ver)
|
||||
else:
|
||||
print(f'Версия {version} не найдена')
|
||||
data = {
|
||||
"unknown": "unknown",
|
||||
"version": version
|
||||
}
|
||||
print(f"Версия {version} не найдена")
|
||||
data = {"unknown": "unknown", "version": version}
|
||||
req_ver = json.dumps(data)
|
||||
await send_request(req_ver)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue