Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Anchor extraction from html document
from bs4 import BeautifulSoup
from urllib.request import urlopen
with urlopen('LINK') as response:
soup = BeautifulSoup(response, 'html.parser')
for anchor in soup.find_all('a'):
print(anchor.get('href', '/'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment