爬取拉勾网
来源:互联网 发布:linux安全加固脚本 编辑:程序博客网 时间:2024/06/08 01:36
# -*- coding: utf-8 -*-# @Time : 2017/8/29 15:14# @Author : z# @File : 拉勾网.py# @Software: PyCharmimport requestsfrom urllib.parse import urlencodefrom bs4 import BeautifulSoupimport jsonimport pandasimport timeclass LaGou(object): def __init__(self,kd='python爬虫'): self.url = "https://www.lagou.com/jobs/positionAjax.json?city=%E5%8C%97%E4%BA%AC&needAddtionalResult=false&isSchoolJob=0" self.headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36', 'Referer':'https://www.lagou.com/jobs/list_python?labelWords=&fromSearch=true&suginput=', 'Host':'www.lagou.com'} self.kd = kd self.list=[] def parse_html(self): self.list.append(['公司', "福利", '地址', '岗位', '薪资', '发布时间', '学历', '工作经验']) for i in range(1, 20): self.data = {'kd': self.kd, 'pn': i, 'first': 'true'} while True: try: response = requests.post(self.url, headers=self.headers, data=self.data).text json_response = json.loads(response) list_all = json_response['content']['positionResult']['result'] break except: time.sleep(1) print('------------------------', i, '-------------------') for i in list_all: list1 = [] list1.append(i['companyFullName']) list1.append(','.join(i['companyLabelList'])) list1.append(i['district']) list1.append(i['positionName']) list1.append(i['salary']) list1.append(i['createTime']) list1.append(i['education']) list1.append(i['workYear']) self.list.append(list1) self.to_file(self.list) def to_file(self,list): pd = pandas.DataFrame(self.list) pd.to_excel('gg.xls')if __name__ == '__main__':LaGou().parse_html()
阅读全文
1 0
- 爬取拉勾网
- scrapy爬取拉勾网
- java爬取拉勾网职位数据
- 爬取拉勾网招聘信息
- Python爬取拉勾网招聘信息
- Scrapy爬取拉勾网职位信息
- python爬取拉勾网任意职位数据
- python爬虫爬取拉勾网职业信息
- 使用scrapy爬取拉勾网职位信息
- Python爬取拉勾网数据存入MySql
- Python爬虫入门-scrapy爬取拉勾网
- Python 爬虫入门-爬取拉勾网实战
- 爬取拉勾网,并进行数据分析
- Python scrapy 爬取拉勾网招聘信息
- python爬取拉勾网数据保存到mysql数据库
- python3爬取拉勾网招聘信息存为excel格式
- 【python爬虫02】使用Scrapy框架爬取拉勾网招聘信息
- 爬取拉勾网招聘信息并使用xlwt存入Excel
- 基于dalvik模式下的Xposed Hook开发的某加固脱壳工具
- 4. Median of Two Sorted Arrays
- CodeChef
- 对Spring的IOC和DI的解释
- IntelliJ IDEA 实现Spring项目的热部署
- 爬取拉勾网
- 哪里可以做机载设备结冰试验,RTCA/DO-160G,Icing Test
- 关于过去,关于现在
- bzoj 1671: [Usaco2005 Dec]Knights of Ni 骑士(BFS)
- Android SurfaceView
- ros slam 问题及对应方案
- Kline
- Java 数据传递(值传递与引用传递)
- Leetcode c语言-3Sum