АК
Size: a a a
АК
АК
АК
АК
АК
À
import json
import requests
from lxml import html
def getCardCount(id = False):
if id != False and myint(id, True) and id > 0:
params = {"targetUrl" : "BP"}
cp = requests.get(f"www.wildberries.ru/catalog/{id}/detail.aspx", params=params)
tree = html.fromstring(cp)
toParse = strip(tree.xpath('//n[@ssrModel:]'))[0,len(strip(tree.xpath('//n[@ssrModel:]')))-1]
jsonObj = json.loads(toParse) :
if jsonObj['productCard']['nomenclature'][id]['orderCount']:
return jsonObj['productCard']['nomenclature'][id]['orderCount']
return false
getCardCount(1)
АК
АК
АК
À