Merged http with __main__ into dhere
This commit is contained in:
@ -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")
|
||||
@ -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")
|
||||
Reference in New Issue
Block a user