最新Boss直聘爬虫系统(在跟~)

最新Boss直聘爬虫系统(在跟~)

BOSS直聘爬虫经常会限制IP,我们采取控制浏览器的方法获取源码爬取

例子:以爬取 杭州市 "BI"岗位为例

需要源码的v+: marshal_wz

功能1:获取对应城市的岗位页面数量

因为BOSS直聘限制了用户只能看到10页数据,所以一般需要分不同区域的来进行爬取,但是也有些区域没有该岗位,导致爬取失败;

首先查看杭州市的所有城市的区号;见博客:https://blog.csdn.net/weixin_52001949/article/details/138193474

  • 确定爬取的配置文件
  • 获取每个区域存在岗位页码的数量。方便后面遍历爬取
  • 可以看到有些地区是没有BI岗位的,最多的岗位区域是330110,余杭区

功能2:获取所有岗位详情的链接,存在本地

根据上述获取到的每个地区存在的最多页面,遍历的时候使用这个值作为最终遍历数。

python 复制代码
岗位详情链接=[]
page_start=1
page_end=2
for area in areaBusiness:
    page_start = 1
    # 获取页码值,如果没有匹配的行,则默认为None
    page_values = 对应页码表[对应页码表['城市'] == area]['页码'].values
    page_end = page_values[0] if len(page_values) > 0 else None
    if page_end is None:
        continue
    for i in range(page_start,int(page_end)+1):
        print(area, i)
        url = f'https://www.zhipin.com/web/geek/job?query={jobs[0]}&city={城市代码}&areaBusiness={code}&experience={experience}&degree={degree}'
        # 使用 Playwright 同步 API
        '获取源代码'
        boss.get(url)  
        WebDriverWait(boss, 10).until(EC.visibility_of_element_located((By.CLASS_NAME, "options-pages")))
        time.sleep(0.5)
        boss_text = boss.page_source
        soup = BeautifulSoup(boss_text, 'html.parser')
        # 找到类名为"options-pages"的<div>标签
        options_pages_div = soup.find('div', class_="options-pages")
        # 在这个<div>内部找到所有的<a>标签
        a_tags = options_pages_div.find_all('a') if options_pages_div else []
        # 从找到的<a>标签中提取文本,忽略空白和非数字内容
        numbers = [tag.text.strip() for tag in a_tags if tag.text.strip().isdigit()]
        # 获取最后一个数字,如果存在的话
        last_number = numbers[-1] if numbers else None
        job_card_left_elements = soup.find_all(class_='job-card-left')
        for element in job_card_left_elements:
            href = element['href']
            full_link = 'https://www.zhipin.com' + href
            岗位详情链接.append(full_link)
df=pd.DataFrame({
'Name':岗位详情链接})f
文件名='岗位详情链接_BI_杭州.xlsx' 
df.to_excel(f"{文件名}")

功能三:遇到需要验证,自动暂停爬取,提示需要手动验证

BOSS直聘会对任何频繁用户进行验证

我们通过控制企业微信的聊天机器人来提示用户需要验证,验证完成之后再进行爬取,基本上不到1000条数据会有提示。

具体链接到:https://blog.csdn.net/weixin_52001949/article/details/137915839?spm=1001.2014.3001.5502

python 复制代码
for i in 岗位详情链接["Name"][s:e]:
    count=count+1
    print(f"开始爬取{count}")
    # 打开网页
    url =f'{i}'
    boss.get(url)  
    time.sleep(random.uniform(10,20))
    #遇到需要验证的话执行qywx_message提示函数。
    if("点击进行验证" in boss.page_source or "您暂时无法继续访问" in boss.page_source):
        print("报错")
        count_end=count
        qywx_message()
        input()
        boss.get(url) 
        time.sleep(random.uniform(10,20))
        detail_code = boss.page_source
        '执行爬取'
        df = pd.concat([df, start_paqu(detail_code)], axis=0)
        df.to_excel(f"{文件名}_爬取到{s}-{e}.xlsx")
    else:
        detail_code = boss.page_source
        df = pd.concat([df, start_paqu(detail_code)], axis=0)
        df.to_excel(f"{文件名}_爬取到{s}-{e}.xlsx")          
相关推荐
雪雪爱冲浪4 小时前
2026 年网络爬虫领域的Puppeteer vs. Playwright
爬虫·网络协议·测试工具·接口隔离原则
深蓝电商API1 天前
mitmproxy高级用法:自定义脚本拦截改包
爬虫·mitmproxy
Fluxproxy1 天前
Python爬虫异步提速终极方案|线程池ThreadPoolExecutor实战,告别单线程慢速爬取
开发语言·爬虫·python
独立开发者阿乐1 天前
llms.txt 是什么?为什么 AI 爬虫需要这个文件
人工智能·爬虫·geo优化·ai爬虫·llms.txt·ai收录·robots.txt
傻啦嘿哟1 天前
高校信息爬虫:爬取全国高校列表与排名,做择校分析
爬虫
深蓝电商API2 天前
HTTP/2 协议逆向:从 Fiddler 抓不到包说起
爬虫·网络协议·http·fiddler
隐擎fox2 天前
深入网络风控底层:解密 IP 信誉评分模型、ASN 属性判定与多租户原生网络隔离架构
网络·爬虫·网络协议·tcp/ip·架构·跨境电商·指纹浏览器
zzp282182 天前
Estyapp逆向分析
爬虫
天启HTTP3 天前
爬虫防封核心原理:IP轮换机制与风控规避逻辑
linux·服务器·网络·爬虫·tcp/ip
SEO_juper3 天前
用 Python 写一个 GEO 可见性检查脚本:你的网站现在能被 AI 引用吗
开发语言·人工智能·爬虫·python·seo·外贸独立站