I am trying to code a scraper that scrapes me the product id of a product on a site.
import requests
from bs4 import BeautifulSoup
URL = 'https://stockx.com/de-de/air-jordan-1-retro-high-dark-mocha'
headers = {
'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36'
}
r = requests.get(URL, headers=headers)
soup = BeautifulSoup(r.text, 'html.parser')
soup.find('div', {'class':'detail'})
print(soup)
I want to access the class="detail", but when executing this it gives me the html of the whole site? What did i do wrong?
Aucun commentaire:
Enregistrer un commentaire