网络刮擦返回一个空列表
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我第一次使用您要的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.