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

Last edited by ylb Apr 25, 2022
Page history
This is an old version of this page. You can view the most recent version or browse the history.

picture_download.md

参数:

{
    "key": "CN208414307U", 
    "url": "http://epub.cnipa.gov.cn/pic.jpg", 	
    "bucket": "patent",
    "real":0,
    "proxy":1,
}
  • key (str): 唯一标识 (必选)
  • url (str): 图片链接 (必选)
  • bucket (str):图片来源 (必选)
  • proxy (int): 是否开启代理 ,0 不开启, 1 开启 ,默认为1
  • real (int):是否实时返回结果 ,可以传 0,1,2,3 ,默认为0
    • 0 表示不要求实时返回结果
    • 1 表示要求实时返回储存url
    • 2 表示要求实时返回图片内容和储存url

返回值:

{   
    "spider_name": "picture_download", 	                    //爬虫名称,str类型
    "platform_name": "picture",                             //爬取平台的名称标识,str类型
    "http_code": 200,                                       //http返回码,int类型
    "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":{
        "key": "CN208414307U", 
        "bucket": "patent",
        "src":"http://{host}/save/{bucket}/{key}/{uuid}.jpg",   //图片储存后的url
        "content":""                                            //图片二进制内容
    }
}
  • 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}/{uuid}.json

流程图:

graph LR
A[spider]
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,2 |G[response] --> K
A-->L[图片本地备份]

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