new commit

This commit is contained in:
54CHA
2025-07-19 17:56:06 +03:00
commit 4153e2c00a
140 changed files with 66097 additions and 0 deletions

101
public/test.html Normal file
View File

@ -0,0 +1,101 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Тест парсера WB</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.container { max-width: 800px; margin: 0 auto; }
input, button { padding: 10px; margin: 5px; }
input[type="text"] { width: 300px; }
#result { margin-top: 20px; padding: 15px; background: #f5f5f5; border-radius: 5px; }
.loading { color: #666; }
.error { color: red; }
.success { color: green; }
</style>
</head>
<body>
<div class="container">
<h1>Тест парсера Wildberries</h1>
<div>
<label>Поисковый запрос:</label><br>
<input type="text" id="query" value="игрушка" placeholder="Введите поисковый запрос">
</div>
<div>
<label>Артикул товара:</label><br>
<input type="text" id="articleId" value="439726135" placeholder="Введите артикул">
</div>
<div>
<button onclick="testParser()">Запустить тест</button>
</div>
<div id="result"></div>
</div>
<script>
async function testParser() {
const resultDiv = document.getElementById('result');
const query = document.getElementById('query').value;
const articleId = document.getElementById('articleId').value;
if (!query || !articleId) {
resultDiv.innerHTML = '<div class="error">Пожалуйста, заполните все поля</div>';
return;
}
resultDiv.innerHTML = '<div class="loading">Запуск парсинга... Это может занять до 60 секунд.</div>';
try {
const response = await fetch('/api/parser', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: query,
myArticleId: articleId
})
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
resultDiv.innerHTML = `
<div class="success">
<h3>Результаты парсинга:</h3>
<h4>Информация о товаре:</h4>
<p><strong>Название:</strong> ${data.products.my.name}</p>
<p><strong>Артикул:</strong> ${data.products.my.articleId}</p>
<p><strong>Цена:</strong> ${data.products.my.price} ₽</p>
<p><strong>Бренд:</strong> ${data.products.my.brand}</p>
<h4>Позиции в городах:</h4>
<table border="1" cellpadding="5">
<tr>
<th>Город</th>
<th>Страница</th>
<th>Позиция</th>
</tr>
${data.positions.map(pos => `
<tr>
<td>${pos.city}</td>
<td>${pos.myPage}</td>
<td>${pos.myPosition}</td>
</tr>
`).join('')}
</table>
<h4>Полный JSON ответ:</h4>
<pre style="background: white; padding: 10px; overflow: auto;">${JSON.stringify(data, null, 2)}</pre>
</div>
`;
} catch (error) {
resultDiv.innerHTML = `<div class="error">Ошибка: ${error.message}</div>`;
}
}
</script>
</body>
</html>