import requests
from bs4 import BeautifulSoup
def extract_all_links(site):
    html = requests.get(site).text
    soup = BeautifulSoup(html, 'html.parser').find_all('a')
    links = [link.get('href') for link in soup]
    return links
site_link = input('Enter URL of the site : ')
all_links = extract_all_links(site_link)
print(all_links)
#scrie intr-un fisier text toate linkurile care se termina cu html
with open('URLs.txt', 'w') as f:
    for link in all_links:
        #if link.endswith('.html' or '.php'):
        f.write(link + '\n')







