... | ... | @@ -3,28 +3,22 @@ |
|
|
```json
|
|
|
{
|
|
|
"key": "CN208414307U",
|
|
|
"url":"http://epub.cnipa.gov.cn/pic/ws9100/PUBXML/EDA0001518996270000011.jpg",
|
|
|
"url": "http://epub.cnipa.gov.cn/pic.jpg",
|
|
|
"bucket": "patent",
|
|
|
"real":0,
|
|
|
"proxy":1,
|
|
|
}
|
|
|
```
|
|
|
|
|
|
* **key** (str): 唯一标识
|
|
|
* **url** (str): 图片链接
|
|
|
* **bucket** (str):图片来源
|
|
|
* **key** (str): 唯一标识 (必选)
|
|
|
* **url** (str): 图片链接 (必选)
|
|
|
* **bucket** (str):图片来源 (必选)
|
|
|
* proxy (int): 是否开启代理 ,0 不开启, 1 开启 ,默认为1
|
|
|
* real (int):是否实时返回结果 ,可以传 0,1,2,3 ,默认为0
|
|
|
* 0 表示不要求实时返回结果
|
|
|
* 1 表示要求实时返回储存url
|
|
|
* 2 表示要求实时返回图片内容和储存url
|
|
|
|
|
|
* host (str): 指定图片储存服务器地址
|
|
|
* path (str): 指定图片储存路径
|
|
|
|
|
|
前三个参数必选
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 返回值:
|
|
|
|
... | ... | @@ -33,39 +27,45 @@ |
|
|
"spider_name": "picture_download", //爬虫名称,str类型
|
|
|
"platform_name": "picture", //爬取平台的名称标识,str类型
|
|
|
"http_code": 200, //http返回码,int类型
|
|
|
"message": "successful", //爬取结束信息,str类型
|
|
|
"retry":0, //重试次数,int类型
|
|
|
"spider_start_time": "2020-07-11 11:30:40", //爬取开始时间,str类型,格式为%Y-%m-%d %H:%M:%S
|
|
|
"spider_end_time": "2020-07-11 11:30:41", //爬取结束时间,str类型,格式为%Y-%m-%d %H:%M:%S
|
|
|
"spider_used_time": 10, //爬取耗时,秒数int类型
|
|
|
"server_host": "10.8.6.51", //爬虫所在机器的IP
|
|
|
"key": "CN208414307U",
|
|
|
"url": "http://epub.cnipa.gov.cn/pic/ws9100/PUBXML/350401/XXSQ/XXSQ_DZGBD/2017218078160/100005/EDA0001518996270000011.jpg",
|
|
|
"bucket": "patent",
|
|
|
"real":0,
|
|
|
"proxy":1,
|
|
|
"host":"",
|
|
|
"path":"", //传入的参数
|
|
|
"message": "successful", //爬取结束信息,str类型
|
|
|
"task_result":1000, //message对应的状态码, int类型
|
|
|
"bucket": "patent",
|
|
|
"parames":{
|
|
|
"spider_start_time": "2020-07-11 11:30:40", //爬取开始时间,str类型,格式为%Y-%m-%d %H:%M:%S
|
|
|
"spider_end_time": "2020-07-11 11:30:41", //爬取结束时间,str类型,格式为%Y-%m-%d %H:%M:%S
|
|
|
"spider_used_time": 10, //爬取耗时,秒数int类型
|
|
|
"server_host": "10.8.6.51",
|
|
|
"url": "http://epub.cnipa.gov.cn/pic.jpg",
|
|
|
"real":0,
|
|
|
"proxy":1,
|
|
|
}, //传入的参数
|
|
|
"data":{
|
|
|
"src":"", //图片储存后的url
|
|
|
"content":"" //图片二进制内容
|
|
|
"key": "CN208414307U",
|
|
|
"bucket": "patent",
|
|
|
"src":"http://{host}/save/{bucket}/{key}/{uuid}.jpg", //图片储存后的url
|
|
|
"content":"" //图片二进制内容
|
|
|
}
|
|
|
}
|
|
|
|
|
|
```
|
|
|
message 值包含:
|
|
|
|
|
|
* successful :成功
|
|
|
* write error : 写入图片文件错误
|
|
|
* status_code error: {status} : http状态码错误
|
|
|
* request error : 请求错误
|
|
|
* url unidentified :图片url解析错误
|
|
|
* parame error : 参数错误
|
|
|
* decode error : 图片内容解码错误
|
|
|
* message 与 task_result 对应关系:
|
|
|
|
|
|
| message | task_result | |
|
|
|
| --------------------------- | ----------- | ---------------- |
|
|
|
| successful | 1000 | 成功 |
|
|
|
| write error | 1001 | 写入图片文件错误 |
|
|
|
| status_code error: {status} | 1002 | http状态码错误 |
|
|
|
| request error | 1003 | 请求错误 |
|
|
|
| url unidentified | 1004 | 图片url解析错误 |
|
|
|
| parame error | 1005 | 参数错误 |
|
|
|
| decode error | 1006 | 图片内容解码错误 |
|
|
|
| save error | 2001 | 储存错误 |
|
|
|
|
|
|
|
|
|
|
|
|
> 目前计划返回结果储存为 json 文件(可结合文件下载服务);
|
|
|
>
|
|
|
> 文件目录格式为: /{bucket}/{date}/**.json
|
|
|
> 文件目录格式为: /{bucket}/{date}/{uuid}.json
|
|
|
|
|
|
|
|
|
|
... | ... | @@ -74,11 +74,14 @@ message 值包含: |
|
|
```mermaid
|
|
|
graph LR
|
|
|
A[spider]
|
|
|
F[udms] --> A-->|real = 0,1,3|E[basket]
|
|
|
B[web] --> A-->|real = 2|G[response]
|
|
|
F[udms] --> A-->E[basket]--> Q[布隆过滤器]
|
|
|
B[web] --> A
|
|
|
C[redis] --> F
|
|
|
D[post]--> B
|
|
|
E -->|real = 0 |K[.json] --> H[kibana]
|
|
|
E -->|real = 1,3 |G --> K
|
|
|
E -->|real = 1,2 |G[response] --> K
|
|
|
A-->L[图片本地备份]
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
``` |
|
|
\ No newline at end of file |