简体   繁体   中英

Unable to parse html of a website using Python and BeautifulSoup

I am trying to collect the href ( click for image ) from the website, https://www.groupeactual.eu/offre-emploi using python and BeautifulSoup module. But for some reason I am not being able to parse the particular html data. What is the solution to this problem. Thanks in advance !

Here is my code,

response = requests.get("https://www.groupeactual.eu/offre-emploi").text
soup = BeautifulSoup(response, "html.parser")
soup1 = soup.find_all("div", class_="js-result-annonce")
soup1

click for image

The websites uses ajax to load the search results. You can see it in the inspector (F12 in Chrome Browser):

chrome 检查器中的网络选项卡

So you probably need inspect the posted data which is sent to https://www.groupeactual.eu/offre-emploi/search and try to make these requests with your scraper script.

How about:

soup.findAll("div", {"class": "js-result-annonce"})

use this:

table = soup.select('div', attrs={"class":"js-result-annonce"})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM