增加博客访问量(Python)

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qq_44198436/article/details/100171684
def go():
    headers = {
        "User-agent": 'Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.11'
    }
    result1=[]
    with open(u'F:\文件.txt',"r") as f:
        for line in f:
                result1.append(list(line.strip('\n').split(',')))
    for i in result1:
        h=''.join(i)
        #print(h)
        proxies = {'https': h}
        print(proxies['https'])
        res=requests.get("https://blog.csdn.net/qq_44198436/article/details/100051651",headers=headers,proxies=proxies)
        if str(res)=='<Response [200]>':
            print('访问成功CSDN成功')
        time.sleep(40)

将代理IP 分行 存入F盘文件.txt
可以用爬虫爬取免费的代理IP

猜你喜欢

转载自blog.csdn.net/qq_44198436/article/details/100171684