Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
K
kb
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • granite
  • kb
  • Wiki
    • Data_stream
  • picture_download.md

picture_download.md · Changes

Page history
Update picture_download.md authored Sep 29, 2021 by 董雨峰's avatar 董雨峰
Hide whitespace changes
Inline Side-by-side
Showing with 43 additions and 40 deletions
+43 -40
  • data_stream/picture_download.md.md data_stream/picture_download.md.md +43 -40
  • No files found.
data_stream/picture_download.md.md
View page @ 38594237
...@@ -3,28 +3,22 @@ ...@@ -3,28 +3,22 @@
```json ```json
{ {
"key": "CN208414307U", "key": "CN208414307U",
"url":"http://epub.cnipa.gov.cn/pic/ws9100/PUBXML/EDA0001518996270000011.jpg", "url": "http://epub.cnipa.gov.cn/pic.jpg",
"bucket": "patent", "bucket": "patent",
"real":0, "real":0,
"proxy":1, "proxy":1,
} }
``` ```
* **key** (str): 唯一标识 * **key** (str): 唯一标识 (必选)
* **url** (str): 图片链接 * **url** (str): 图片链接 (必选)
* **bucket** (str):图片来源 * **bucket** (str):图片来源 (必选)
* proxy (int): 是否开启代理 ,0 不开启, 1 开启 ,默认为1 * proxy (int): 是否开启代理 ,0 不开启, 1 开启 ,默认为1
* real (int):是否实时返回结果 ,可以传 0,1,2,3 ,默认为0 * real (int):是否实时返回结果 ,可以传 0,1,2,3 ,默认为0
* 0 表示不要求实时返回结果 * 0 表示不要求实时返回结果
* 1 表示要求实时返回储存url * 1 表示要求实时返回储存url
* 2 表示要求实时返回图片内容和储存url * 2 表示要求实时返回图片内容和储存url
* host (str): 指定图片储存服务器地址
* path (str): 指定图片储存路径
前三个参数必选
## 返回值: ## 返回值:
...@@ -33,39 +27,45 @@ ...@@ -33,39 +27,45 @@
"spider_name": "picture_download", //爬虫名称,str类型 "spider_name": "picture_download", //爬虫名称,str类型
"platform_name": "picture", //爬取平台的名称标识,str类型 "platform_name": "picture", //爬取平台的名称标识,str类型
"http_code": 200, //http返回码,int类型 "http_code": 200, //http返回码,int类型
"message": "successful", //爬取结束信息,str类型 "message": "successful", //爬取结束信息,str类型
"retry":0, //重试次数,int类型 "task_result":1000, //message对应的状态码, int类型
"spider_start_time": "2020-07-11 11:30:40", //爬取开始时间,str类型,格式为%Y-%m-%d %H:%M:%S "bucket": "patent",
"spider_end_time": "2020-07-11 11:30:41", //爬取结束时间,str类型,格式为%Y-%m-%d %H:%M:%S "parames":{
"spider_used_time": 10, //爬取耗时,秒数int类型 "spider_start_time": "2020-07-11 11:30:40", //爬取开始时间,str类型,格式为%Y-%m-%d %H:%M:%S
"server_host": "10.8.6.51", //爬虫所在机器的IP "spider_end_time": "2020-07-11 11:30:41", //爬取结束时间,str类型,格式为%Y-%m-%d %H:%M:%S
"key": "CN208414307U", "spider_used_time": 10, //爬取耗时,秒数int类型
"url": "http://epub.cnipa.gov.cn/pic/ws9100/PUBXML/350401/XXSQ/XXSQ_DZGBD/2017218078160/100005/EDA0001518996270000011.jpg", "server_host": "10.8.6.51",
"bucket": "patent", "url": "http://epub.cnipa.gov.cn/pic.jpg",
"real":0, "real":0,
"proxy":1, "proxy":1,
"host":"", }, //传入的参数
"path":"", //传入的参数
"data":{ "data":{
"src":"", //图片储存后的url "key": "CN208414307U",
"content":"" //图片二进制内容 "bucket": "patent",
"src":"http://{host}/save/{bucket}/{key}/{uuid}.jpg", //图片储存后的url
"content":"" //图片二进制内容
} }
} }
``` ```
message 值包含:
* successful :成功 * message 与 task_result 对应关系:
* write error : 写入图片文件错误
* status_code error: {status} : http状态码错误 | message | task_result | |
* request error : 请求错误 | --------------------------- | ----------- | ---------------- |
* url unidentified :图片url解析错误 | successful | 1000 | 成功 |
* parame error : 参数错误 | write error | 1001 | 写入图片文件错误 |
* decode error : 图片内容解码错误 | status_code error: {status} | 1002 | http状态码错误 |
| request error | 1003 | 请求错误 |
| url unidentified | 1004 | 图片url解析错误 |
| parame error | 1005 | 参数错误 |
| decode error | 1006 | 图片内容解码错误 |
| save error | 2001 | 储存错误 |
> 目前计划返回结果储存为 json 文件(可结合文件下载服务); > 目前计划返回结果储存为 json 文件(可结合文件下载服务);
> >
> 文件目录格式为: /{bucket}/{date}/**.json > 文件目录格式为: /{bucket}/{date}/{uuid}.json
...@@ -74,11 +74,14 @@ message 值包含: ...@@ -74,11 +74,14 @@ message 值包含:
```mermaid ```mermaid
graph LR graph LR
A[spider] A[spider]
F[udms] --> A-->|real = 0,1,3|E[basket] F[udms] --> A-->E[basket]--> Q[布隆过滤器]
B[web] --> A-->|real = 2|G[response] B[web] --> A
C[redis] --> F C[redis] --> F
D[post]--> B D[post]--> B
E -->|real = 0 |K[.json] --> H[kibana] 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
Clone repository
  • README
  • basic_guidelines
  • basic_guidelines
    • basic_guidelines
    • dev_guide
    • project_build
    • 开发流程
  • best_practice
  • best_practice
    • AlterTable
    • RDS
    • azkaban
    • create_table
    • design
    • elasticsearch
    • elasticsearch
      • ES运维
    • logstash
View All Pages