Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. from urllib.request import urlopen
  2. from urllib.error import HTTPError
  3. from bs4 import BeautifulSoup
  4. import re
  5.  
  6. try:
  7. content = urlopen("watch-at-cafe-6-online-free.html")
  8. soup = BeautifulSoup(content.read(),"html.parser")
  9. except HTTPErrrot as he:
  10. print(he)
  11. #exit()
  12. #continue
  13. except AttributeError as ae:
  14. print(ae)
  15. exit()
  16.  
  17. #print(soup.h1)
  18.  
  19.  
  20.  
  21. for link in soup.find_all('a'):
  22. print(link.get('href'))
  23.  
  24. #how do i get this to out-put an lxml file ?????????
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement