Python 刷點擊量的代碼
[Python]代碼
import webbrowser as web
import re
import urllib
import time
import os
def spider(url,urlpattern):
urls=getURLs(url,urlpattern)
for url in urls:
visitURL(url)
def visitURL(url):
url=url[:-1] #remove the " at the end of the string
print(url)
#print("\n")
web.open(url,1,False)
time.sleep(5)
def getURLs(url,urlpattern):
urls=[]
response=urllib.urlopen(url)
html=response.read()
pattern=re.compile(urlpattern)
urls=pattern.findall(html)
urls=list(set(urls))
return urls
if __name__=="__main__":
urls={
"這里填寫你blog的地址"
}
for i in range(1,10):
for url,urlpattern in urls.items():
spider(url,urlpattern)
print("Blogs has been refreshed for ", i, " times")
os.system("taskkill /F /IM chrome.exe") 本文由用戶 y0657bys 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!