web_scrap/web_scrap.py
2023-02-28 22:03:03 +01:00

17 lines
469 B
Python

#!/usr/bin/python3
# Python 3
# Extraction des liens d'une page web
from bs4 import BeautifulSoup
import requests
page = requests.get("https://www.clarissariviere.com")
if page.status_code == 200:
soup = BeautifulSoup(page.text, 'html.parser')
ul = soup.find_all("ul", id="listsmooth")
for anchor in ul[0].find_all("a"):
href = anchor.get('href', '/')
if href != "#" and href != "http://www.clarissariviere.com/":
print(href)