Loading

代理

使用代理防止大量爬取时被封ip

原理

普通访问b站

image

使用代理,d为代理ip

image

示例

# 原理. 通过第三方的一个机器去发送请求
import requests


# 218.60.8.83:3129
proxies = {
    "https": "https://218.60.8.83:3129"
}

resp = requests.get("https://www.baidu.com", proxies=proxies)
resp.encoding = 'utf-8'
print(resp.text)
posted @ 2024-12-19 22:30  一只大学生  阅读(17)  评论(0)    收藏  举报