-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f2dcc8
commit b78f694
Showing
7 changed files
with
31 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,47 @@ | ||
## 代理 IP 使用说明 | ||
> 还是得跟大家再次强调下,不要对一些自媒体平台进行大规模爬虫或其他非法行为,要踩缝纫机的哦🤣 | ||
> 另外如果要是用代理功能,请安装Redis并设置一个密码,从下面的流程图讲解了redis在这个缓存功能中起到的作用 | ||
> 还是得跟大家再次强调下,不要对一些自媒体平台进行大规模爬虫或其他非法行为,要踩缝纫机的哦🤣 | ||
### 简易的流程图 | ||
|
||
![代理 IP 使用流程图](../static/images/代理IP%20流程图.drawio.png) | ||
|
||
### 准备代理 IP 信息 | ||
点击 <a href="https://www.jisuhttp.com/?pl=mAKphQ&plan=ZY&kd=Yang">极速HTTP代理</a> 官网注册并实名认证(国内使用代理 IP 必须要实名,懂的都懂) | ||
点击 <a href="https://www.kuaidaili.com/?ref=ldwkjqipvz6c">快代理</a> 官网注册并实名认证(国内使用代理 IP 必须要实名,懂的都懂) | ||
|
||
### 获取 IP 提取链接 | ||
> 每个人注册并实名认证后都会送一定的余额。(当然有些网站上也有一些免费的IP,但失效时间极快,也体验过一些免费的 IP 代理池,轮询去找一个可用IP都得半天) | ||
### 获取 IP 代理的密钥信息 | ||
从 <a href="https://www.kuaidaili.com/?ref=ldwkjqipvz6c">快代理</a> 官网获取免费试用,如下图所示 | ||
![img.png](../static/images/img.png) | ||
|
||
在IP提取页面点击生成 API 链接,这样就会生成一个跟你账号相关的IP提取的链接,其中我们只需要关注2个参数<br> | ||
`key`、`crypto`,比如下面这张图中`key=w3q**********` `crypto=2f945*********` | ||
注意:选择私密代理 | ||
![img_1.png](../static/images/img_1.png) | ||
|
||
![img.png](../static/images/IP_提取图.png) | ||
选择开通试用 | ||
![img_2.png](../static/images/img_2.png) | ||
|
||
### 将提取密钥参数 key crypto 写入环境变量 | ||
> 或者直接在代码中填写 `key` 和 `crypto` 的值 | ||
初始化一个快代理的示例,如下代码所示,需要4个参数 | ||
|
||
![img_1.png](../static/images/修改代理密钥.png) | ||
```python | ||
def new_kuai_daili_proxy() -> KuaiDaiLiProxy: | ||
""" | ||
构造快代理HTTP实例 | ||
Returns: | ||
""" | ||
return KuaiDaiLiProxy( | ||
kdl_secret_id=os.getenv("kdl_secret_id", "你的快代理secert_id"), | ||
kdl_signature=os.getenv("kdl_signature", "你的快代理签名"), | ||
kdl_user_name=os.getenv("kdl_user_name", "你的快代理用户名"), | ||
kdl_user_pwd=os.getenv("kdl_user_pwd", "你的快代理密码"), | ||
) | ||
|
||
### 将配置文件中的`ENABLE_IP_PROXY`置为 `True` | ||
> `IP_PROXY_POOL_COUNT` 池子中 IP 的数量 | ||
``` | ||
在试用的订单中可以看到这四个参数,如下图所示 | ||
|
||
### 其他说明 | ||
> 代理IP池使用了redis来缓存IP和记录过期时间 | ||
> 使用 <a href="https://sider.ai/invited?c=8e03db1a973401fdf114ed9cf9f8c183">chatgpt</a> 快速询问如何安装 redis 并设置密码 | ||
`kdl_user_name`、`kdl_user_pwd` | ||
![img_3.png](../static/images/img_3.png) | ||
|
||
`kdl_secret_id`、`kdl_signature` | ||
![img_4.png](../static/images/img_4.png) | ||
|
||
### 将配置文件中的`ENABLE_IP_PROXY`置为 `True` | ||
> `IP_PROXY_POOL_COUNT` 池子中 IP 的数量 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
# @Author : [email protected] | ||
# @Time : 2024/4/5 09:32 | ||
# @Desc : 已废弃!!!!!倒闭了!!!极速HTTP 代理IP实现 | ||
# @Desc : 已废弃!!!!!倒闭了!!!极速HTTP 代理IP实现. 请使用快代理实现(proxy/providers/kuaidl_proxy.py) | ||
import os | ||
from typing import Dict, List | ||
from urllib.parse import urlencode | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.