Guest User

Untitled

a guest
Dec 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import requests
  2. import webbrowser
  3. from bs4 import BeautifulSoup
  4.  
  5. targetSite = "http://abc.com/"
  6.  
  7. def getHtml(url):
  8. response = requests.get(url)
  9. response.encoding = response.apparent_encoding
  10. return BeautifulSoup(response.text, 'lxml')
  11.  
  12.  
  13. pageNum = 1
  14. while True:
  15. html = getHtml(targetSite+"page/"+str(pageNum))
  16.  
  17. ~~~~略~~~~
  18.  
  19. inp = input("END?(e) >> ")
  20. if inp == "e" : break
  21. else:
  22. pageNum += 1
  23.  
  24. getHtml(targetSite+"page/"+str(5))
Add Comment
Please, Sign In to add comment