网络刮擦返回一个空列表

发布于 2025-01-31 03:42:50 字数 362 浏览 1 评论 0原文

 import requests
 from bs4 import BeautifulSoup

 result = requests.get('https://www.indeed.com/?vjk=5bc59746be36d8d0')
 source = result.content
 soup = BeautifulSoup(source, "lxml")

 job_titles = soup.find_all("a", {"class": "jcs-JobTitle"})

 print(job_titles)

这里的问题是打印job_titles返回一个空列表,而不是网站中的作业标题,

请帮助我解决此问题,任何帮助都将不胜感激

 import requests
 from bs4 import BeautifulSoup

 result = requests.get('https://www.indeed.com/?vjk=5bc59746be36d8d0')
 source = result.content
 soup = BeautifulSoup(source, "lxml")

 job_titles = soup.find_all("a", {"class": "jcs-JobTitle"})

 print(job_titles)

The problem here that printing job_titles returns an empty list instead of the job titles in the web site

please help me fix this problem and any help would be appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鸢与 2025-02-07 03:42:50

当我第一次使用您要的URL时,向我展示了一个搜索页面,没有列出任何工作。直到我提交搜索后,该页面才填充了结果。当我再次返回原始URL时,该页面仍然填充(可能带有缓存结果)。从请求获得页面时,空白页可能是您返回的内容。

尝试将完整的URL与浏览器转发到搜索后转发您的参数。例如,url https://www.indeed.com/jobs?q=data%20Engineer&l=raleigh%2C%20NC&; amp; vjk = b971ec43674ab50e给我15个作业标题链接。

When I first went to the URL you're requesting, I was shown a search page with no jobs listed. It was only after I submitted a search that the page was populated with results. When I returned to the original URL again, the page was still populated (possibly with cached results). The blank page is probably what you're getting back when you get the page from requests.

Try using the full URL with parameters that the browser forwards you to after a search. For example, the URL https://www.indeed.com/jobs?q=data%20engineer&l=Raleigh%2C%20NC&vjk=b971ec43674ab50e gives me back 15 job title links.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文