Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. import urllib.request
  2. from bs4 import BeautifulSoup
  3.  
  4. def get_urls(url, proxy=None):
  5. i = 1
  6. with urllib.request.urlopen(linkToRes) as response:
  7. html = response.read()
  8. soup = BeautifulSoup(html, 'html.parser')
  9. for link in soup.find_all('a'):
  10. print(str(i)+".", 'Link:', link.get('href'), 'Tags:', link.text)
  11.  
  12.  
  13. linkToRes = "https://de.wikipedia.org/wiki/Links"
  14. get_urls(linkToRes)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement