Python 刷点击量的代码
2018-07-20 来源:open-open
[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")
标签: 代码
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
最新资讯
热门推荐