答:
您想获取关于北上广深和长沙五个城市的招聘信息,并且针对BI、ETL、数据挖掘、AI、人工智能、模型和数据分析等职位进行筛选。您还提到每条招聘信息需要获取的字段(排除红圈内的标签)。
为了获取这些招聘信息,您可以使用Python和Selenium库进行网页爬取。Selenium是一个用于自动化浏览器操作的工具,可以模拟浏览器行为来进行网页数据的提取。
以下是一个示例代码,可以帮助您实现这个任务:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# 设置浏览器驱动路径,这里使用的是Chrome浏览器,请确保已经安装对应版本的Chrome浏览器和驱动
driver = webdriver.Chrome('path_to_chrome_driver')
# 设置待搜索的关键字列表
keywords = ['BI', 'ETL', '数据挖掘', 'AI', '人工智能', '模型', '数据分析']
# 设置待搜索的城市列表
cities = ['北京', '上海', '广州', '深圳', '长沙']
# 进行循环搜索
for city in cities:
for keyword in keywords:
# 构建搜索链接
search_link = f'https://{city}.58.com/job/?key={keyword}'
# 打开搜索链接
driver.get(search_link)
# 等待搜索结果加载完成
WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, 'jobname')))
# 获取所有招聘信息
job_elements = driver.find_elements(By.CLASS_NAME, 'jobname')
# 遍历每条招聘信息
for job_element in job_elements:
# 排除红圈内的标签
red_circles = job_element.find_elements(By.CLASS_NAME, 'red-circle')
if len(red_circles) > 0:
continue
# 获取字段信息
job_title = job_element.text
company_name = job_element.find_element(By.CLASS_NAME, 'compname').text
salary = job_element.find_element(By.CLASS_NAME, 'salary').text
job_location = job_element.find_element(By.CLASS_NAME, 'region').text
# 输出字段信息
print("职位:", job_title)
print("公司:", company_name)
print("薪资:", salary)
print("地点:", job_location)
print("=" * 50)
# 关闭浏览器
driver.quit()
这段代码通过设置关键字和城市列表,在58同城的招聘页面进行搜索和遍历,并使用Selenium提供的方法来提取各个字段信息。需要注意的是,代码中的'path_to_chrome_driver'需要替换为您真实的Chrome驱动路径。
希望这个示例代码对您有帮助!您想获取关于北上广深和长沙五个城市的招聘信息,并且针对BI、ETL、数据挖掘、AI、人工智能、模型和数据分析等职位进行筛选。您还提到每条招聘信息需要获取的字段(排除红圈内的标签)。
为了获取这些招聘信息,您可以使用Python和Selenium库进行网页爬取。Selenium是一个用于自动化浏览器操作的工具,可以模拟浏览器行为来进行网页数据的提取。
以下是一个示例代码,可以帮助您实现这个任务:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# 设置浏览器驱动路径,这里使用的是Chrome浏览器,请确保已经安装对应版本的Chrome浏览器和驱动
driver = webdriver.Chrome('path_to_chrome_driver')
# 设置待搜索的关键字列表
keywords = ['BI', 'ETL', '数据挖掘', 'AI', '人工智能', '模型', '数据分析']
# 设置待搜索的城市列表
cities = ['北京', '上海', '广州', '深圳', '长沙']
# 进行循环搜索
for city in cities:
for keyword in keywords:
# 构建搜索链接
search_link = f'https://{city}.58.com/job/?key={keyword}'
# 打开搜索链接
driver.get(search_link)
# 等待搜索结果加载完成
WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, 'jobname')))
# 获取所有招聘信息
job_elements = driver.find_elements(By.CLASS_NAME, 'jobname')
# 遍历每条招聘信息
for job_element in job_elements:
# 排除红圈内的标签
red_circles = job_element.find_elements(By.CLASS_NAME, 'red-circle')
if len(red_circles) > 0:
continue
# 获取字段信息
job_title = job_element.text
company_name = job_element.find_element(By.CLASS_NAME, 'compname').text
salary = job_element.find_element(By.CLASS_NAME, 'salary').text
job_location = job_element.find_element(By.CLASS_NAME, 'region').text
# 输出字段信息
print("职位:", job_title)
print("公司:", company_name)
print("薪资:", salary)
print("地点:", job_location)
print("=" * 50)
# 关闭浏览器
driver.quit()
这段代码通过设置关键字和城市列表,在58同城的招聘页面进行搜索和遍历,并使用Selenium提供的方法来提取各个字段信息。需要注意的是,代码中的'path_to_chrome_driver'需要替换为您真实的Chrome驱动路径。
希望这个示例代码对您有帮助!