#๐ Webscraping Clothing Prices off websites
12 messages ยท Page 1 of 1 (latest)
@nimble hearth
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
what.
Hi, so I'm making a webscraping script to scrape the brand name, clothing type, and the percentage breakdown of materials from a clothing website.
This is a sample response:
{
"brand": "Primark",
"cloth_type": "t-shirt",
"materials": [
"56%: Viscose",
"40%: Nylon",
"4%: Elastane"
],
"sustainability_rating": 43.2
}
This works fine, but I'm trying to scrape the price of a certain product, but I'm not sure how because most sites have a lot of recommended products under a certain product that has prices on them and in the HTML code the tags are all near identical. How do I isolate the correct price of the main product on a webpage? Here is a webpage for reference: https://www.abercrombie.com/shop/us/p/athletic-straight-jeans-50635343?categoryId=61102441&faceout=model&seq=04
Sorry idk why my original message deleted
you need to target specific html elements that uniquely identify the main products price
so
use BeautifulSoup
yup, i've been using bs4 for the project
yeah so look for unique html attributes or classes that identify the main product's price. use find() or find_all() with beautifulsoup to grab it
cool thanks
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.