Skip to content

Instantly share code, notes, and snippets.

@openroomxyz
Created April 22, 2020 20:36
Show Gist options
  • Save openroomxyz/2857cb2a9fb97c9c45793abaf6b940a1 to your computer and use it in GitHub Desktop.
Save openroomxyz/2857cb2a9fb97c9c45793abaf6b940a1 to your computer and use it in GitHub Desktop.
Python : How can i get get all url -s on page ? (html only)
import bs4 as bs
import urllib.request
sauce = urllib.request.urlopen('https://singularityhub.com/').read()
soup = bs.BeautifulSoup(sauce, 'lxml')
for url in soup.find_all('a'):
#print(url)
print(url.text)
print(url.get('href'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment