Sinisterly
Web Scraping with BeautifulSoup and Requests py - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Coding (https://sinister.ly/Forum-Coding--71)
+--- Thread: Web Scraping with BeautifulSoup and Requests py (/Thread-Web-Scraping-with-BeautifulSoup-and-Requests-py)



Web Scraping with BeautifulSoup and Requests py - vluzzy - 01-02-2024

import requests
from bs4 import BeautifulSoup

url = 'https://example.com'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')

# Extract all the links on the webpage
links = [a['href'] for a in soup.find_all('a', href=True)]
print("Links on the webpage:", links)