As a example to get the Cargo Pant.
Will use CSS Selector the can target a specific tag.
If would recommend to learn the more standar way as i shown here.
To do the same as shown here you most read the doc for requests-html,it has support for both CSS Selector and XPath Selector,so it shold work there to.
As i mention in your other post the lack of updates an response in Issues Tracker is a concern for this library.
Will use CSS Selector the can target a specific tag.
import requests from bs4 import BeautifulSoup url = 'https://www.supremenewyork.com/shop/all/pants' response = requests.get(url) soup = BeautifulSoup(response.content, 'lxml') cargo_pants = soup.select_one('#container > article:nth-child(4) > div > a')Usage for getting
href
and src
.Output:>>> cargo_pants
<a href="/shop/pants/xz7ypjoam/yd2ny9jom" style="height:150px;"><img alt="Zhlkcvj 5dw" height="150" src="//assets.supremenewyork.com/187255/vi/zhlKcVj_5dw.jpg" width="150"/></a>
>>> cargo_pants.get('href')
'/shop/pants/xz7ypjoam/yd2ny9jom'
>>> cargo_pants.img.get('src')
'//assets.supremenewyork.com/187255/vi/zhlKcVj_5dw.jpg
Now you are using requests-html which you should mention as this is not at all common knowledge.If would recommend to learn the more standar way as i shown here.
To do the same as shown here you most read the doc for requests-html,it has support for both CSS Selector and XPath Selector,so it shold work there to.
As i mention in your other post the lack of updates an response in Issues Tracker is a concern for this library.