Advertisement
Guest User

Untitled

a guest
Jun 4th, 2025
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. def ExtractLinks(url):
  5.  
  6. links = []
  7.  
  8.  
  9. website = requests.get(url)
  10.  
  11. website_text = website.text
  12.  
  13.  
  14. soup = BeautifulSoup (website_text, "html.parser")
  15. for link in soup.find_all("a") :
  16. links.append(link.get("href"))
  17.  
  18. for link in links:
  19. print (link)
  20.  
  21. print(len(links))
  22.  
  23. ExtractLinks("https://bplant.org/")
  24. ExtractLinks("https://www.vidlii.com/")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement