【问题标题】:How to select particular region and scrape all the Jobs from a website如何选择特定区域并从网站上抓取所有工作
【发布时间】:2026-02-06 09:00:01
【问题描述】:

我正在尝试通过选择一个特定的国家/地区从一个招聘门户网站抓取所有招聘信息。

很抱歉贴了一张图片,但目的是向您展示页面的外观。

我尝试了什么:

以下是我尝试过的,但我没有得到任何东西刚开始学习网络抓取..

import requests
from bs4 import BeautifulSoup


job_url = 'https://wd3.myworkdayjobs.com/careers/'
out_req = requests.get(job_url)
soup = BeautifulSoup(out_req.text, 'html.parser')
print(soup)
urls = []
for link in soup.find_all('a'):
   print(link.get('href'))

任何帮助将不胜感激。

【问题讨论】:

  • 它是 scrape 不是 scrapscrap - 丢弃或从服务中删除。
  • @baduker,感谢您纠正和教授 scrapscrape,但我已经纠正了错字。语言上,我不是以英语为母语的人,请原谅我的简短。
  • 亲爱的,您可以使用 selenium Web 驱动程序来实现。如果您想查看它,我可以与您分享基本代码。谢谢
  • @HassanALi,谢谢您的帮助。

标签: python python-3.x linux web-scraping


【解决方案1】:

尝试 selenium 库,基于属性搜索 & 搜索结果后 scrape 使用美丽的汤。

from selenium import webdriver
#browser exposes an executable file
#Through Selenium test we will invoke the executable file which will then #invoke actual browser
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
# to maximize the browser window
driver.maximize_window()
#get method to launch the URL
driver.get("Website")
#to refresh the browser
driver.refresh()
# identifying the checkboxes with type attribute in a list
chk =driver.find_elements_by_xpath("//input[@type='checkbox']")
# len method is used to get the size of that list
print(len(chk))
# get_attribute method is get the value attribute
for i in chk:
if i.get_attribute("value") == "United states of America":
i.click()
#to close the browser
driver.close()
#############################
#Beautiful soup code here
#############################

【讨论】:

  • @Bhargav,感谢您提供的代码,我将尝试检查它。
  • 是刮而不是废。报废就是扔掉,就像垃圾一样