Merged http with __main__ into dhere

This commit is contained in:
2025-05-19 04:04:26 +02:00
parent cba300368b
commit 646bf248ba
2 changed files with 20 additions and 18 deletions

View File

@ -1,7 +1,12 @@
from concurrent.futures import ThreadPoolExecutor
import pyperclip
import cloudscraper
from tqdm import tqdm
concurrent_downloads = 5
scraper = cloudscraper.CloudScraper()
failed = []
@ -22,4 +27,18 @@ def download(url: str):
file.write(data)
except Exception as ex:
failed.append(url)
failed.append(url)
if __name__ == "__main__":
with ThreadPoolExecutor(max_workers=concurrent_downloads) as exe:
for line in pyperclip.paste().splitlines():
line = line.strip()
if line == "":
continue
exe.submit(download, line)
if len(failed) != 0:
with open("failed.log", "w") as file:
for url in failed:
file.write(url+"\n")

View File

@ -1,17 +0,0 @@
from .http import download, failed
from concurrent.futures import ThreadPoolExecutor
import pyperclip
if __name__ == "__main__":
with ThreadPoolExecutor(max_workers=5) as exe:
for line in pyperclip.paste().splitlines():
line = line.strip()
if line == "":
continue
exe.submit(download, line)
if len(failed) != 0:
with open("failed.log", "w") as file:
for url in failed:
file.write(url+"\n")