{
"state":0,
"data":
{
"products":
[
{"id":6583968,"root":5214366,"kindId":0,"subjectId":436,"subjectParentId":49,"name":"Спрей","brand":"Ollin Professional","brandId":11981,"siteBrandId":21981,"sale":24,"priceU":85100,"salePriceU":64600,"pics":8,"rating":5,"feedbacks":32767,"colors":[],"sizes":[{"name":"","origName":"0","rank":0,"optionId":23181493}],"diffPrice":false},
{"id":3861036,"root":3198966,"kindId":0,"subjectId":358,"subjectParentId":49,"name":"Шампунь","brand":"Ollin Professional","brandId":11981,"siteBrandId":21981,"sale":24,"priceU":111400,"salePriceU":84600,"pics":8,"rating":4,"feedbacks":3586,"colors":[],"sizes":[{"name":"","origName":"0","rank":0,"optionId":14625839}],"diffPrice":false},
{"id":7052045,"root":5547739,"kindId":0,"subjectId":372,"subjectParentId":49,"name":"Сыворотка","brand":"d'Alba","brandId":26057,"siteBrandId":36057,"sale":25,"priceU":370000,"salePriceU":277500,"pics":15,"rating":4,"feedbacks":2175,"colors":[],"sizes":[{"name":"","origName":"0","rank":0,"optionId":24472815}],"diffPrice":false},
{"id":3860934,"root":3198957,"kindId":0,"subjectId":364,"subjectParentId":49,"name":"Флюид","brand":"Ollin Professional","brandId":11981,"siteBrandId":21981,"sale":24,"priceU":98400,"salePriceU":74700,"pics":8,"rating":5,"feedbacks":6549,"colors":[],"sizes":[{"name":"","origName":"0","rank":0,"optionId":14625737}],"diffPrice":false}
]
}
}
User-Agent: Любой UA браузера
Accept: */*
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
Origin: https://www.wildberries.ru
Connection: keep-alive
Referer: https://www.wildberries.ru/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
"""Изначальный вариант, подразумевается что <a> только в структуре, что вы привели"""
items = soup.find_all("a")
for catalog in items:
catalog_title = catalog.text
print(catalog_title)
"""Если тег <a> еще где-то присутствет на странице"""
items = soup.find_all("div", class_="product-snippet__desc")
for catalog in items:
a_tags = catalog.find_all("a")
for a in a_tags:
catalog_title = a.text
print(catalog_title)
"""Стандартный цикл проходящий по всем корневым элементам"""
for item in store:
"""Цикл, который пройдет все вложенные элементы вне зависимости от колличества"""
for subitem in store[item]:
"""Собственно получение необходимых значений"""
quantity = subitem['quantity']
price = subitem['price']
print(f'Название:{item}\nКолличество:{quantity}\nЦена:{price}\n\n')
import requests
import lxml
from bs4 import BeautifulSoup
resultList = []
web = 'example.com'
response = requests.get(web)
soup = BeautifullSoup(response.text, "lxml")
for td in soup.findAll('td'):
resultList.append(td.text)
print(resultList)