山东平妍商贸有限公司

监事
山东平妍商贸有限公司 · 3年经验
山东平妍商贸有限公司
日薪: ¥500/8h
地点: 山东 全区
时间: 下班后周六周日可工作日远程
ID:319561 复制

0
接单数
0
评价数
0
收藏数

AI 技能提取 | MongoDB Linux
本人熟悉Linux,熟练掌握爬虫、数据分析,ffmpeg音视频剪辑MongoDB等,主修爬虫方向、前后端开发、平面设计等有专业的技术支持。
工作认真负责,有一定的时间可以为您服务。安全、环保与消防、职业卫生相关专业经验丰富可以从事安全、环保、职业卫生、消防相关的软件开发和相关程序开发。

import requests,csv
import json
import jsonpath
from lxml import etree
from parsel import Selector


class MySpider(object):
def __init__(self):
self.url = 'http://www.xinfadi.com.cn/getPriceData.html'
self.headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36',
'Cookie':''
}
self.header = ['菜名','最低价','最高价','单位']
self.shucai_list = []

self.sum_dict = {
'list': []
}


def get_html(self):
response = requests.post(url=self.url, headers=self.headers,timeout=(3, 7))
data = {
'prodPcatid': 1186

}

shuju = response.json()
prodName = jsonpath.jsonpath(shuju,'$..prodName')
lowPrice = jsonpath.jsonpath(shuju,'$..lowPrice')
highPrice = jsonpath.jsonpath(shuju, '$..highPrice')
unitInfo = jsonpath.jsonpath(shuju, '$..unitInfo')
print(zip(prodName,lowPrice,highPrice,unitInfo))
for i in zip(prodName,lowPrice,highPrice,unitInfo):
shu_ju ={
'菜名':i[0],
'最低价':i[1],
'最高价':i[2],
'单位':i[3]


}
self.sum_dict['list'].append(shu_ju)
print(self.sum_dict)





def save_json(self):
with open('新发地.csv', 'w', encoding='utf-8') as f:
json.dump(self.sum_dict, f, ensure_ascii=False, indent=4)
writer = csv.DictWriter(f, self.header)
writer.writeheader()
writer.writerows(self.shucai_list)

if __name__ == '__main__':
my_spider = MySpider()
my_spider.get_html()
my_spider.save_json()
以上爬虫小案例,本案例比较简单核心的东西没放进去,自动翻页,逆向啥的省略了。
山东平妍商贸有限公司 ID:319561 复制

山东平妍商贸有限公司

监事 · 3年经验 · 山东平妍商贸有限公司
城市山东 全区 日薪500元/8h 时间 下班后周六周日可工作日远程
0
累计接单
0
用户评价
0
被收藏

信用行为

0
接单数
0
评价数
0
收藏数

技术能力

AI 技能提取 | MongoDB Linux
本人熟悉Linux,熟练掌握爬虫、数据分析,ffmpeg音视频剪辑MongoDB等,主修爬虫方向、前后端开发、平面设计等有专业的技术支持。
工作认真负责,有一定的时间可以为您服务。安全、环保与消防、职业卫生相关专业经验丰富可以从事安全、环保、职业卫生、消防相关的软件开发和相关程序开发。

项目经验

import requests,csv
import json
import jsonpath
from lxml import etree
from parsel import Selector


class MySpider(object):
def __init__(self):
self.url = 'http://www.xinfadi.com.cn/getPriceData.html'
self.headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36',
'Cookie':''
}
self.header = ['菜名','最低价','最高价','单位']
self.shucai_list = []

self.sum_dict = {
'list': []
}


def get_html(self):
response = requests.post(url=self.url, headers=self.headers,timeout=(3, 7))
data = {
'prodPcatid': 1186

}

shuju = response.json()
prodName = jsonpath.jsonpath(shuju,'$..prodName')
lowPrice = jsonpath.jsonpath(shuju,'$..lowPrice')
highPrice = jsonpath.jsonpath(shuju, '$..highPrice')
unitInfo = jsonpath.jsonpath(shuju, '$..unitInfo')
print(zip(prodName,lowPrice,highPrice,unitInfo))
for i in zip(prodName,lowPrice,highPrice,unitInfo):
shu_ju ={
'菜名':i[0],
'最低价':i[1],
'最高价':i[2],
'单位':i[3]


}
self.sum_dict['list'].append(shu_ju)
print(self.sum_dict)





def save_json(self):
with open('新发地.csv', 'w', encoding='utf-8') as f:
json.dump(self.sum_dict, f, ensure_ascii=False, indent=4)
writer = csv.DictWriter(f, self.header)
writer.writeheader()
writer.writerows(self.shucai_list)

if __name__ == '__main__':
my_spider = MySpider()
my_spider.get_html()
my_spider.save_json()
以上爬虫小案例,本案例比较简单核心的东西没放进去,自动翻页,逆向啥的省略了。
客服二维码

没找到合适的人才?

扫码添加客服极速匹配,或直接发布需求让更多人才主动报名

平台担保交易 · 1小时内不满意可退款

平台信誉与实力

基于 35,336 需求方信任

  • 支付宝企业信用分 优秀 评级
  • 市场份额约占全行业三分之一
  • 程序员兼职行业全能首选平台
查看平台资质详情
收藏