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/ws9100/PUBXML/350401/XXSQ/XXSQ_DZGBD/2017218078160/100005/EDA0001518996270000011.jpg", 	"bucket": "patent",
    "real":0,
    "proxy":1,
    "host":"",
    "path":"",
}
  • key (str): 唯一标识

  • url (str): 图片链接

  • bucket (str):图片来源

  • proxy (int): 是否开启代理 ,0 不开启, 1 开启 ,默认为1

  • real (int):是否实时返回结果 ,可以传 0,1,2,3 ,默认为0

    • 0 表示不要求实时返回结果
    • 1 表示要求实时返回储存url
    • 2 表示要求实时返回图片内容,不储存
    • 3 表示要求实时返回图片内容和储存url
  • host (str): 指定图片储存服务器地址

  • path (str): 指定图片储存路径

前三个参数必选

返回值:

{   
    "spider_name": "picture_download", 	                    //爬虫名称,str类型
    "platform_name": "picture",                             //爬取平台的名称标识,str类型
    "http_code": 200,                                       //http返回码,int类型
    "message": "seccessful",                                //爬取结束信息,str类型         
    "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
	"parames":{
        {
    "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":"",
}

    },                                                       //传入的参数
    "data":{
            "src":"http://{host}/save/{bucket}/{key}/{uuid}.jpg",   //图片储存后的url
    		"content":""                                            //图片二进制内容
    }
}

目前计划返回结果储存为 json 文件(可结合文件下载服务);

文件目录格式为: /{bucket}/{date}/{uuid}.json

流程图:

graph LR
A[spider]
F[udms] --> A-->|real = 0,1,3|E[basket]
B[web] --> A-->|real = 2|G[response] -->H[log]
C[redis]  --> F
D[post]--> B
E -->|real = 0 |K[.json] --> H
E -->|real = 1,3 |G --> H
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