0
votes

I need to scrape for the Review on the Nike Website.

I successfully extract the Class for the review but the Review itself is inside a .

My code is below:

*res = requests.get("https://www.nike.com/fr/t/polo-coupe-slim-polo-pour-kfhFZM/BQ4461-482")

soup = bs4.BeautifulSoup(res.text,'lxml')

product = soup.select(".review.mb10-sm")

for item in soup.select(".review.mb10-sm"): print(item.text)*

[Out]: **"Summer polo shirtA L. - 18 nov. 2020Great for wearing in the summer. I recommend it for the material and comfort.",

"Très bon produit !V I. - 25 juin 2020Rien à dire si ce n'est que je le recommande vivement"**

I want only the words "Great for wearing in the summer. I recommend it for the material and comfort." and "Great for wearing in the summer. I recommend it for the material and comfort.".

Please find below the screenshot for the html of the page.

enter image description here

1
Are you seriously saying you can't figure out how to do that? You can see, I presume, that there is a pattern. Title, user initials, date. So, look for the date. - Tim Roberts
How do I get rid of <p style="word-wrap:break-word">? - Yudhisteer Chintaram

1 Answers

0
votes

You just need to go deeper in the css query, instead of

soup.select(".review.mb10-sm") 

change it to

soup.select(".review.mb10-sm div p")