Skip to content

Instantly share code, notes, and snippets.

@NecRaul
Last active November 3, 2025 12:58
Show Gist options
  • Select an option

  • Save NecRaul/4fc3bd564b64c39cfd144ed8405972db to your computer and use it in GitHub Desktop.

Select an option

Save NecRaul/4fc3bd564b64c39cfd144ed8405972db to your computer and use it in GitHub Desktop.
Archive
#!/usr/bin/env python
import requests
import time
import os
with open("urls", "r") as f_urls, open("titles", "r") as f_titles:
urls = f_urls.read().splitlines()
titles = f_titles.read().splitlines()
if len(urls) != len(titles):
print("Error: The number of urls and titles do not match.")
exit(1)
def download_file(url, filename):
response = requests.get(url, stream=True)
if response.status_code == 200:
with open(filename, "wb") as f:
for chunk in response.iter_content(1024):
f.write(chunk)
print(f"Downloaded: {filename}")
time.sleep(3)
else:
print(f"Failed to download ({response.status_code}): {url}")
for url, title in zip(urls, titles):
epoch = os.path.basename(url).split(".")[0]
filename = f"{epoch} {title}"
download_file(url, filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment