Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import webbrowser
- from bs4 import BeautifulSoup
- targetSite = "http://abc.com/"
- def getHtml(url):
- response = requests.get(url)
- response.encoding = response.apparent_encoding
- return BeautifulSoup(response.text, 'lxml')
- pageNum = 1
- while True:
- html = getHtml(targetSite+"page/"+str(pageNum))
- ~~~~略~~~~
- inp = input("END?(e) >> ")
- if inp == "e" : break
- else:
- pageNum += 1
- getHtml(targetSite+"page/"+str(5))
Add Comment
Please, Sign In to add comment