2024年Python最全Python爬取Boss直聘,帮你获取全国各类职业薪酬榜(1)

文章描述了一个使用Python编写的爬虫程序,专门抓取智联招聘上的职位信息,包括城市、职位、薪资和公司,用于分析全国薪酬数据并生成图表。
摘要由CSDN通过智能技术生成

代码


import requests

from bs4 import BeautifulSoup

import csv

import random

import time

import argparse

from pyecharts.charts import Line

import pandas as pd

class BossCrawler:

def init(self, query):

self.query = query

self.filename = ‘boss_info_%s.csv’ % self.query

self.city_code_list = self.get_city()

self.boss_info_list = []

self.csv_header = [“city”, “profession”, “salary”, “company”]

@staticmethod

def getheaders():

user_list = [

“Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16”,

“Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14”,

“Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 12.14”,

“Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0) Opera 12.14”,

“Opera/12.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.02”,

“Opera/9.80 (Windows NT 6.1; U; es-ES) Presto/2.9.181 Version/12.00”,

“Opera/9.80 (Windows NT 5.1; U; zh-sg) Presto/2.9.181 Version/12.00”,

“Opera/12.0(Windows NT 5.2;U;en)Presto/22.9.168 Version/12.00”,

“Opera/12.0(Windows NT 5.1;U;en)Presto/22.9.168 Version/12.00”,

“Mozilla/5.0 (Windows NT 5.1) Gecko/20100101 Firefox/14.0 Opera/12.0”,

“Opera/9.80 (Windows NT 6.1; WOW64; U; pt) Presto/2.10.229 Version/11.62”,

“Opera/9.80 (Windows NT 6.0; U; pl) Presto/2.10.229 Version/11.62”,

“Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52”,

“Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; de) Presto/2.9.168 Version/11.52”,

“Opera/9.80 (Windows NT 5.1; U; en) Presto/2.9.168 Version/11.51”,

“Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; de) Opera 11.51”,

“Opera/9.80 (X11; Linux x86_64;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值