Created
September 13, 2023 22:39
-
-
Save 0scvr/c85ff296d14ae7de123286db9c6e441f to your computer and use it in GitHub Desktop.
Download songs (+metadata) from Spotify with doubledouble.top
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import time | |
# Function to make a GET request to the given URL with retries | |
def make_get_request_with_retry(url, params=None, max_retries=5, retry_delay=6): | |
for _ in range(max_retries): | |
try: | |
response = requests.get(url, params=params) | |
response.raise_for_status() | |
return response.json() | |
except requests.exceptions.RequestException as e: | |
print(f"Error making GET request to {url}: {str(e)}") | |
print(f"Retrying in {retry_delay} seconds...") | |
time.sleep(retry_delay) | |
return None | |
# Function to download a song from a URL | |
def download_song(url, download_urls_file): | |
params = { | |
"url": url, | |
"external": "sendcm", | |
"format": "mp3" | |
} | |
get_response = make_get_request_with_retry("https://doubledouble.top/dl", params) | |
if get_response and get_response.get("success"): | |
song_id = get_response.get("id") | |
time.sleep(15) | |
for _ in range(5): | |
dl_url = f"https://doubledouble.top/dl/{song_id}" | |
get_response = make_get_request_with_retry(dl_url) | |
if get_response and get_response.get("url"): | |
download_url = get_response['url'] | |
print(f"Download URL for {url}: {download_url}") | |
download_urls_file.write(f"{download_url}\n") | |
download_urls_file.flush() | |
break | |
else: | |
print(f"Retrying download for {url} in 10 seconds...") | |
time.sleep(10) | |
else: | |
print(f"Failed to initiate download for {url}") | |
# Read the list of URLs from 'song_urls.txt' file | |
with open('song_urls.txt', 'r') as file: | |
urls = file.readlines() | |
# Open a file to save the download URLs | |
with open('download_urls.txt', 'w') as download_urls_file: | |
# Process each URL | |
for url in urls: | |
url = url.strip() # Remove leading/trailing whitespace | |
download_song(url, download_urls_file) |
me when i publically flex my abuse of free public services
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hey buddy what if you didn't do that