{
"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
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("user-data-dir=/home/sergey/SeleniumProfile")
driver = webdriver.Chrome(chrome_options=options)
driver.get("https://google.com")
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("user-data-dir=C:\\profile")
driver = webdriver.Chrome(chrome_options=options)
driver.get("https://google.com")
bot.on('message', msg => {
const session = getSessionFromDb(msg.from.id)
if (session === 'foo') { //пользователь уже ввёл напоминание
//обрабатываем одним способом
} else if (session === 'bar') { //пользователь не ввёл
//обрабатываем другим способом
}
})
Если у меня нет аналитического мышления
со временем и практикой код станет лучше?
Или лучше бросить мучить комп и бросать ?
function createTree(data) {
const obl = {};
const org = {};
const podr = {};
data.forEach(n => {
obl[n.obl.id] = { ...n.obl, children: [] };
org[n.org.id] = { ...n.org, children: [] };
podr[n.podr.id] = { ...n.podr, children: [] };
});
data.forEach(n => podr[n.podr.id].children.push({ ...n.dolzh }));
Object.values(org).forEach(n => obl[n.parent_obl].children.push(n));
Object.values(podr).forEach(n => org[n.parent_org].children.push(n));
return Object.values(obl);
}
const tree = createTree(arr);