import requests
from time import time
from threading import Thread

start = time()


urls_404 = []


def check_url(target_url):
    if requests.get(target_url).status_code == 404:
        urls_404.append(target_url)


with open("list.txt") as f:
    urls = f.read().splitlines()


threads = []

for url in urls:
    thread = Thread(target=check_url, args=(url,))
    thread.start()
    threads.append(thread)


for thread in threads:
    thread.join()

print("\n".join(urls_404))


with open("404.txt", "w") as f:
    f.write("\n".join(urls_404))

print(time() - start)
