Skip to content

Instantly share code, notes, and snippets.

@fastfingertips
Created February 20, 2022 16:05
Show Gist options
  • Save fastfingertips/18dea26f117475c878b8b9debdbe43e2 to your computer and use it in GitHub Desktop.
Save fastfingertips/18dea26f117475c878b8b9debdbe43e2 to your computer and use it in GitHub Desktop.
Scraping Link from HTML
from bs4 import BeautifulSoup
import requests, re
def getDom(_url):
return requests.get(_url).text # response
urlDom = getDom(input('Url: '))
parserDom = BeautifulSoup(urlDom, 'html.parser')
for link in parserDom.find_all('a', attrs={'href': re.compile('^https://')}):
print(link.get('href'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment