【Python】如何用较快速度用Python程序增加博客访问量——CSDN、博客园、知乎(应该包括简书)

首先有几个要点:

  1. 用一个ip连续访问是肯定不行的,博客的系统肯定有算法等着你呢
  2. 所以就得换着使用不同的ip访问,这样博客的系统是不能“拒绝”你的。
  3. 当然,你需要空开时间访问,要不然密集的访问也会让博客“有反应”
  4. 解决方案:多线程+用不同的ip请求+无限循环

我们先来看一个我的失败样例,这是用C++写的,集成了所有缺陷。

#include<stdio.h>  
#include<math.h>  
#include<windows.h>  //注意!!!windows.h是必须打的!
int main(){  
    while(1){  
        system("start www.***.com");
        Sleep(100);
        system("taskkill /f /im chrome.exe");  
    }  
    return 0;  
}  

时间没有流出,而且使用单个ip

好了我们说说python的“正解”

我的代码很简陋,很像打表,但是很有用处,ip地址列表千万不要动

大家可以在这里

 添加上你的博客文章链接。

ip地址应该还没有失效,此文章的发布日期:2021年2月25日20:22:23,如果失效,可以在如下网址找到很多ip

地址1:https://ip.jiangxianli.com/

地址2:http://www.xiladaili.com/

然后将损坏的ip替换成现有的。

如下——垃圾代码

import urllib.request
import random
import time
import _thread

cnt = 0


def increases(name, urls):
    print("启动线程:{0}
".format(name))
    proxy_list = [
        {"http": "124.88.67.54:80"},
        {"http": "61.135.217.7:80"},
        {"http": "42.231.165.132:8118"},
        {"http": "201.91.82.155:3128"},
        {"http": "116.196.85.150:3128"},
        {"http": "182.18.13.149:53281"},
        {"http": "138.199.29.131:3128"},
        {"http": "218.60.8.83:3129"},
        {"http": "80.94.195.122:3128"},
        {"http": "218.60.8.99:3129"},
        {"http": "45.173.73.115:8080"},
        {"http": "185.204.216.70:3128"},
        {"http": "138.199.29.142:3128"},
        {"http": "54.39.51.99:3128"},
        {"http": "37.235.97.15:3128"},
        {"http": "51.75.147.41:3128"},
        {"http": "51.254.237.77:3129"},
        {"http": "159.203.44.177:3128"},
        # {"https":"103.153.66.27:8080"},
        # {"https":"173.249.38.220:8118"},
        # {"https":"150.138.253.72:808"},
        # {"https":"103.126.87.150:8080"},
        # {"https":"51.75.144.32:3128"},
        {"http": "103.214.54.90:8080"},
        {"http": "162.214.92.202:80"},
        {"http": "190.248.153.162:8080"},
        {"http": "88.99.10.251:1080"},
        {"http": "138.199.29.162:3128"},
        {"http": "136.233.215.142:80"},
        {"http": "182.160.124.26:8081"},
        {"http": "159.65.171.69:80"},
        {"http": "188.120.232.181:8118"},
        {"http": "14.97.2.106:80"},
        {"http": "45.224.22.66:999"},
        {"http": "103.36.11.14:8181"},
        {"http": "103.214.54.90:8080"},
        {"http": "203.202.245.58:80"},
        {"http": "151.106.34.87:80"},
        {"http": "162.214.92.202:80"},
        {"http": "190.248.153.162:8080"},
        {"http": "77.232.100.132:80"},
        {"http": "150.109.32.166:80"},
        {"http": "178.63.126.13:1080"},
        {"http": "34.203.142.175:80"},
        {"http": "12.20.241.112:80"},
        {"http": "116.117.134.134:9999"},
        {"http": "123.56.239.196:3128"},
        {"http": "220.181.111.37:80"},

    ]
    while True:
        proxy = random.choice(proxy_list)  # 随机选择一个ip地址
        httpproxy_handler = urllib.request.ProxyHandler(proxy)
        opener = urllib.request.build_opener(httpproxy_handler)
        request = urllib.request.Request(urls)
        response = opener.open(request)
        print("Thread {0} request successfuly      Time:{1}|||||||||||||".format(name, time.ctime(time.time())))
        time.sleep(60)


t1s = "https://thomas.blog.csdn.net/article/details/113521118"
t2s = "https://thomas.blog.csdn.net/article/details/113785548"
t3s = "https://thomas.blog.csdn.net/article/details/113954372"
t4s = "https://thomas.blog.csdn.net/article/details/104332627"
t5s = "https://thomas.blog.csdn.net/article/details/108267019"
t6s = "https://thomas.blog.csdn.net/article/details/113731438"
t7s = "https://thomas.blog.csdn.net/article/details/104816540"
t8s = "https://www.cnblogs.com/coding365/p/CPP_Tutorials.html"
t9s = "https://zhuanlan.zhihu.com/p/352895647";

t10s="https://thomas.blog.csdn.net/article/details/113433546"
t11s="https://thomas.blog.csdn.net/article/details/113445902"
t12s="https://thomas.blog.csdn.net/article/details/113421790"
t13s="https://thomas.blog.csdn.net/article/details/113785737"
t14s="https://thomas.blog.csdn.net/article/details/113800936"
t15s="https://thomas.blog.csdn.net/article/details/108913378"
t16s="https://thomas.blog.csdn.net/article/details/108922320"
t17s="https://thomas.blog.csdn.net/article/details/108922571"
t18s="https://thomas.blog.csdn.net/article/details/107016967"

try:
    _thread.start_new_thread(increases, ("t1", t1s))
    _thread.start_new_thread(increases, ("t2", t2s))
    _thread.start_new_thread(increases, ("t3", t3s))
    _thread.start_new_thread(increases, ("t4", t4s))
    _thread.start_new_thread(increases, ("t5", t5s))
    _thread.start_new_thread(increases, ("t6", t6s))
    _thread.start_new_thread(increases, ("t7", t7s))
    _thread.start_new_thread(increases, ("t8", t8s))
    _thread.start_new_thread(increases, ("t9", t1s))
    _thread.start_new_thread(increases, ("t10", t2s))
    _thread.start_new_thread(increases, ("t11", t3s))
    _thread.start_new_thread(increases, ("t12", t4s))
    _thread.start_new_thread(increases, ("t13", t5s))
    _thread.start_new_thread(increases, ("t14", t6s))
    _thread.start_new_thread(increases, ("t15", t7s))
    _thread.start_new_thread(increases, ("t16", t8s))
    _thread.start_new_thread(increases, ("t17", t1s))
    _thread.start_new_thread(increases, ("t18", t2s))
    _thread.start_new_thread(increases, ("t19", t3s))
    _thread.start_new_thread(increases, ("t20", t4s))
    _thread.start_new_thread(increases, ("t21", t5s))
    _thread.start_new_thread(increases, ("t22", t6s))
    _thread.start_new_thread(increases, ("t23", t7s))
    _thread.start_new_thread(increases, ("t24", t8s))
    _thread.start_new_thread(increases, ("t25", t1s))
    _thread.start_new_thread(increases, ("t26", t2s))
    _thread.start_new_thread(increases, ("t27", t3s))
    _thread.start_new_thread(increases, ("t28", t4s))
    _thread.start_new_thread(increases, ("t29", t5s))
    _thread.start_new_thread(increases, ("t30", t6s))
    _thread.start_new_thread(increases, ("t31", t7s))
    _thread.start_new_thread(increases, ("t32", t8s))
    _thread.start_new_thread(increases, ("t33zhihu", t9s))
    _thread.start_new_thread(increases, ("t34zhihu", t9s))
    _thread.start_new_thread(increases, ("t35zhihu", t9s))
    _thread.start_new_thread(increases, ("t36zhihu", t9s))
    _thread.start_new_thread(increases, ("t1", t1s))
    _thread.start_new_thread(increases, ("t2", t2s))
    _thread.start_new_thread(increases, ("t3", t3s))
    _thread.start_new_thread(increases, ("t4", t4s))
    _thread.start_new_thread(increases, ("t5", t5s))
    _thread.start_new_thread(increases, ("t6", t6s))
    _thread.start_new_thread(increases, ("t7", t7s))
    _thread.start_new_thread(increases, ("t8", t8s))
    _thread.start_new_thread(increases, ("t9", t1s))
    _thread.start_new_thread(increases, ("t10", t2s))
    _thread.start_new_thread(increases, ("t11", t3s))
    _thread.start_new_thread(increases, ("t12", t4s))
    _thread.start_new_thread(increases, ("t13", t5s))
    _thread.start_new_thread(increases, ("t14", t6s))
    _thread.start_new_thread(increases, ("t15", t7s))
    _thread.start_new_thread(increases, ("t16", t8s))
    _thread.start_new_thread(increases, ("t17", t1s))
    _thread.start_new_thread(increases, ("t18", t2s))
    _thread.start_new_thread(increases, ("t19", t3s))
    _thread.start_new_thread(increases, ("t20", t4s))
    _thread.start_new_thread(increases, ("t21", t5s))
    _thread.start_new_thread(increases, ("t22", t6s))
    _thread.start_new_thread(increases, ("t23", t7s))
    _thread.start_new_thread(increases, ("t24", t8s))
    _thread.start_new_thread(increases, ("t25", t1s))
    _thread.start_new_thread(increases, ("t26", t2s))
    _thread.start_new_thread(increases, ("t27", t3s))
    _thread.start_new_thread(increases, ("t28", t4s))
    _thread.start_new_thread(increases, ("t29", t5s))
    _thread.start_new_thread(increases, ("t30", t6s))
    _thread.start_new_thread(increases, ("t31", t7s))
    _thread.start_new_thread(increases, ("t32", t8s))
    _thread.start_new_thread(increases, ("t33zhihu", t9s))
    _thread.start_new_thread(increases, ("t34zhihu", t9s))
    _thread.start_new_thread(increases, ("t35zhihu", t9s))
    _thread.start_new_thread(increases, ("t36zhihu", t9s))
    #
    _thread.start_new_thread(increases, ("t10s", t10s))
    _thread.start_new_thread(increases, ("t11s", t11s))
    _thread.start_new_thread(increases, ("t12s", t12s))
    _thread.start_new_thread(increases, ("t13s", t13s))
    _thread.start_new_thread(increases, ("t14s", t14s))
    _thread.start_new_thread(increases, ("t15s", t15s))
    _thread.start_new_thread(increases, ("t16s", t16s))
    _thread.start_new_thread(increases, ("t17s", t17s))
    _thread.start_new_thread(increases, ("t18s", t18s))

    _thread.start_new_thread(increases, ("t10s", t10s))
    _thread.start_new_thread(increases, ("t11s", t11s))
    _thread.start_new_thread(increases, ("t12s", t12s))
    _thread.start_new_thread(increases, ("t13s", t13s))
    _thread.start_new_thread(increases, ("t14s", t14s))
    _thread.start_new_thread(increases, ("t15s", t15s))
    _thread.start_new_thread(increases, ("t16s", t16s))
    _thread.start_new_thread(increases, ("t17s", t17s))
    _thread.start_new_thread(increases, ("t18s", t18s))
except Exception as E:
    print(E)

print("END")

while 1:
    pass
 
原文地址:https://www.cnblogs.com/coding365/p/Increase_PageView_Python.html