Skip to content

Instantly share code, notes, and snippets.

@fastfingertips
Last active February 3, 2023 02:42
Show Gist options
  • Save fastfingertips/aed60b24c310c78a00828ac36bef669c to your computer and use it in GitHub Desktop.
Save fastfingertips/aed60b24c310c78a00828ac36bef669c to your computer and use it in GitHub Desktop.
extract URL from HTML Page using BeautifulSoup
from bs4 import BeautifulSoup
import requests
inputUrl = input('Enter the url: ')
urlReq = requests.get(inputUrl)
reqData = urlReq.text
dataDom = BeautifulSoup(reqData)
domLinks = dataDom.find_all('a')
for linkNo, link in enumerate(domLinks): print(linkNo,link.get('href'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment