• Python刷CSDN博客访问量的N种方法 , 亲测可用


    1 单独刷某一篇

    #!/usr/bin/env python
    #coding=utf-8
    import webbrowser as web
    import time
    import os
    import random
     
    count = random.randint(10, 20)    #产生随机数
    j = 0;
    while j < count:
    	i = 0
    	while i < 3:                #循环打开次数
    		web.open_new_tab('http://blog.csdn.net/yuan_lo/article/details/xxx')   #要刷的博客
    		i = i + 1
    		time.sleep(0.8)                   #让进程停留0.8,
    	os.system('killall firefox')              #关闭浏览器
    	j = j + 1
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    2 遍历刷多篇

    16篇原创博文的地址放在一个txt文件,设置循环访问,每次访问间隔3s,每轮访问间隔30s,如此一来,访问所有博文一遍大概需要一分半钟,一小时可以刷到600的访问量.

    1. blogs.txt
    https://blog.csdn.net/qq_33704787/article/details/xxx
    https://blog.csdn.net/qq_33704787/article/details/xxx
    https://blog.csdn.net/qq_33704787/article/details/xxx
    https://blog.csdn.net/qq_33704787/article/details/xxx
    https://blog.csdn.net/qq_33704787/article/details/xxx
    https://blog.csdn.net/qq_33704787/article/details/xxx
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    1. main.py
    import requests
    import time
    
    from bs4 import BeautifulSoup
    i=1
    
    while True:
        file=open('blogs.txt', 'r',encoding='utf-8',errors='ignore')
        while True:
            url=file.readline().rstrip()
    
            header={"user-agent":"Mozilla/5.0"}
    
            try:
                data=requests.get(url=url,headers=header)
            except ValueError:
                break
            else:
                print(data.status_code,end='')
                if(data.status_code == 200):
                    print(f"访问{url}成功")
                else:
                    print(f"访问{url}失败")
                time.sleep(3)
        file.close()
        print(f"第{i}轮")
        time.sleep(30)
        i+=1
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
  • 相关阅读:
    Redis 高可用原理(荣耀典藏版)
    【Memento模式】C++设计模式——备忘录模式
    C++ slice类
    大麦网-演出赛事票务系统画uml图
    软件测试之路已不再是坦途
    【css】深入理解flex属性
    JVM内存管理面试常见问题全解
    python学习笔记(3)—— 数据结构
    基于Pytorch框架的深度学习MobileViT神经网络鸟类识别分类系统源码
    蓝牙BQB PTS工具的安装
  • 原文地址:https://blog.csdn.net/qq_33704787/article/details/125498295