【python脚本】-刷CSDN博客流量
本脚本可以通过打开CSDN博客页面,来增加博客访问量。前置条件:安装了python安装了浏览器内核,我这里用的是chrome的脚本如下:#!/usr/bin/evn python# -*- encoding: utf-8 -*-"""@File:blog.py@Time:2019/1/22 8:42@Author :Robin@Desc""&quo
·
本脚本可以通过打开CSDN博客页面,来增加博客访问量。
前置条件:
安装了python
安装了浏览器内核,我这里用的是chrome的
脚本如下:
#!/usr/bin/evn python
# -*- encoding: utf-8 -*-
"""
@File :blog.py
@Time :2019/1/22 8:42
@Author :Robin
@Desc
"""
from selenium import webdriver
import time
from fake_useragent import UserAgent
from bs4 import BeautifulSoup
from selenium.webdriver.support.wait import WebDriverWait
options = webdriver.ChromeOptions()
# 隐藏"Chrome正在受到自动软件的控制"
options.add_argument('disable-infobars')
options.add_argument('user-agent='+UserAgent().random)
# 采用上述配置
browser = webdriver.Chrome(options=options)
# 将浏览器窗口最大化
# browser.maximize_window()
browser.set_window_size(560, 400)
s_time = time.time()
url = list()
a = 0
s_time = time.time()
for i in range(1, 5):
browser.get("https://blog.csdn.net/weixin_41423450/article/list/"+str(i))
for link in browser.find_elements_by_xpath("//*[@href]"):
if('https://blog.csdn.net/weixin_41423450/article/details/' in link.get_attribute('href') and link.get_attribute('href') not in url):
url.append(link.get_attribute('href'))
print(link.get_attribute('href'))
link.click()
a = a + 1
print(a)
print(time.time() - s_time)
browser.quit()
把脚本中链接地址中的用户名改成自己的就OK了,循环里的变量是文章列表页数。
同一IP在短时间内多次访问只算一次,自行把握脚本执行时间,访问量稍微刷一些就OK了,毕竟不是别人欣赏自己的文章来访问的,就算流量上去了,也会因为假的性质而缺少实际意义。(偶尔用用,给自己长点自信)
更多推荐



所有评论(0)