Skip to content

Instantly share code, notes, and snippets.

@shubham-singh-ss
Created July 3, 2019 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shubham-singh-ss/e4a1b0cd6b898e125910cdb5f29e4348 to your computer and use it in GitHub Desktop.
Save shubham-singh-ss/e4a1b0cd6b898e125910cdb5f29e4348 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
# 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