写在最前面:
鉴于我的博客访问量少的可怜,本人比较懒又不高兴每天点开自己手动刷访问量,于是结合selenium搞了个自动的程序每天刷点访问量,赚点积分。
直接上代码:
from selenium import webdriver
import time
import threading
def mycsdn():
driver = webdriver.Chrome()
i = 'https://blog.csdn.net/ssjdoudou/article/details/'
j = ['83987504','83545438','84023801','84036156','83934801','83934801','83931392','83927099','83901600','83869532']
js = 'window.open("https://blog.csdn.net/ssjdoudou");'
driver.execute_script(js)
for k in range(10):
s = i + j[k]
#print('window.open("{url}");'.format(url=s))
driver.execute_script('window.open("{url}");'.format(url=s))
time.sleep(2)
driver.quit()
def mytime():
while 1:
mycsdn()
time.sleep(200)
if __name__ == "__main__":
t = threading.Thread(target=mytime())
t.start()