Я новичок в веб-поиске и собираю данные о продукте с сайта Target.
Подсвеченные части изображения
![enter image description here](https://i.stack.imgur.com/RxJJ3.png)
Мне удалось получить название продукта и цену, но остальная информация не может быть найдена с помощью BeautifulSoup.Например, при проверке почтового индекса он показывает почтовый индекс с тегом data-test, но при поиске тега он не может быть найден.Кто-нибудь испытывал это раньше или знает способ получить эту информацию?
Использование Python 3 и BeautifulSoup.
Не уверен, что лучший способ сформулировать этот вопрос, поэтому дайте мне знать, если вам нужно больше информации или мне нужно перефразировать.
<a href="#" class="h-text-underline Link-sc-1khjl8b-0 jvxzGg" data-test="storeFinderZipToggle">35401</a>
import requests
from bs4 import BeautifulSoup
f = open("demofile.txt", "w")
Page_Source = "https://www.target.com/p/nintendo-switch-with-neon-blue-and-neon-red-joy-con/-/A-52189185"
page = requests.get(Page_Source)
soup = BeautifulSoup(page.content, 'html.parser')
#write all the html code to a file to compare source files
f.write(str(soup))
#should contain city location but Secondary header can't be found
#location = soup.find("div", {'class', 'HeaderSecondary'})
#inside the secondary header should contain the store name but is not found
#store_location = location.find('div', {'data-test': 'storeId-store-name'})
#store_location = location.find('button', {'id': 'storeId-utility-NavBtn'})
#contains the rest of the information interested in
main_container = soup.find(id="mainContainer")
#complete_product_name = soup('span',attrs={'data-test':'product-title'})[0].text
product_price = soup.find("span", {'data-test': 'product-price'})
product_title = soup.find("span", {'data-test': 'product-title'})
flexible_fulfillment = main_container.find('div', {'data-test': 'flexible_fulfillment'})
#test = product_zip.find_all('a')
#example = soup.find_all("div", {'data-test': 'storePickUpType'})
example = soup.findAll('div', attrs={'data-test':'maxOrderQuantityTxt'})
print(product_title)
print(product_price)
print(flexible_fulfillment)
f.close()