mirror of
https://github.com/Maks1mS/free-ozon-dpr.git
synced 2024-12-24 02:52:58 +03:00
Compare commits
6 Commits
70364d671a
...
9215bc9522
Author | SHA1 | Date | |
---|---|---|---|
9215bc9522 | |||
64394ada44 | |||
3701d2b125 | |||
24f5a53913 | |||
deeed2e2ef | |||
ccdce54b73 |
@ -1,66 +1,66 @@
|
||||
{
|
||||
"name": "Global Express",
|
||||
"source": "https://t.me/Mariupol_global_express/1989",
|
||||
"source": "https://t.me/Mariupol_global_express/1977",
|
||||
"points": [
|
||||
{
|
||||
"coordinates": [
|
||||
37.775896,
|
||||
47.959707
|
||||
],
|
||||
"name": "Донецк 7 (микр-н Звездный)",
|
||||
"link": "https://ozon.ru/point/534953",
|
||||
"address": "Донецк, пр-кт Ленинский 98А",
|
||||
"operationTime": "пн-вс с 9:00 до 17:00"
|
||||
},
|
||||
{
|
||||
"coordinates": [
|
||||
37.811995,
|
||||
48.011767
|
||||
],
|
||||
"name": "Донецк 8 (Крытый рынок)",
|
||||
"link": "https://ozon.ru/point/533323",
|
||||
"address": "Донецк, ул. 50-летия СССР 157А",
|
||||
"operationTime": "пн-пт с 9:00 до 17:00"
|
||||
"name": "г. Донецк, ул. 50-летия СССР, 157А",
|
||||
"address": "г. Донецк, ул. 50-летия СССР, 157А",
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>"
|
||||
},
|
||||
{
|
||||
"coordinates": [
|
||||
37.799192,
|
||||
47.991666
|
||||
],
|
||||
"name": "Донецк 1 (Южный)",
|
||||
"link": "https://ozon.ru/point/533347",
|
||||
"address": "Донецк, площадь Коммунаров 1к1, ТЦ «Южный»",
|
||||
"operationTime": "пн-пт с 9:00 до 17:00, сб-вс с 10:00 ло 17:00"
|
||||
"name": "г. Донецк, площадь Коммунаров 1к1, ТЦ «Южный»",
|
||||
"address": "г. Донецк, площадь Коммунаров 1к1, ТЦ «Южный»",
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>"
|
||||
},
|
||||
{
|
||||
"coordinates": [
|
||||
37.775896,
|
||||
47.959707
|
||||
],
|
||||
"link": "https://ozon.ru/point/534953",
|
||||
"name": "г. Донецк, пр - кт Ленинский, 98Аостановка «Звездный»",
|
||||
"address": "г. Донецк, пр - кт Ленинский, 98Аостановка «Звездный»",
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>"
|
||||
},
|
||||
{
|
||||
"coordinates": [
|
||||
38.635921,
|
||||
48.047327
|
||||
],
|
||||
"name": "Торез 3",
|
||||
"link": "https://ozon.ru/point/533350",
|
||||
"name": "г. Торез, 4й микрорайон, (торговые павильоны в районе дома 23)",
|
||||
"address": "г. Торез, 4й микрорайон, (торговые павильоны в районе дома 23)",
|
||||
"operationTime": "пн-вс с 9:00 до 17:00"
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>"
|
||||
},
|
||||
{
|
||||
"coordinates": [
|
||||
38.761523,
|
||||
48.021133
|
||||
],
|
||||
"name": "Снежное",
|
||||
"link": "https://ozon.ru/point/534920",
|
||||
"name": "Снежное, ул. Дзержинского, 2",
|
||||
"address": "Снежное, ул. Дзержинского, 2",
|
||||
"operationTime": "пн-вс с 9:00 до 17:00"
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>"
|
||||
},
|
||||
{
|
||||
"coordinates": [
|
||||
38.208714,
|
||||
48.221055
|
||||
],
|
||||
"name": "Енакиево",
|
||||
"link": "https://ozon.ru/point/534903",
|
||||
"name": "Енакиево, проспект Ленина, 98в",
|
||||
"address": "Енакиево, проспект Ленина, 98в",
|
||||
"operationTime": "пн-вс с 9:00 до 17:00"
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>"
|
||||
}
|
||||
]
|
||||
}
|
16
eslint.config.js
Normal file
16
eslint.config.js
Normal file
@ -0,0 +1,16 @@
|
||||
import globals from "globals";
|
||||
import pluginJs from "@eslint/js";
|
||||
|
||||
export default [
|
||||
{
|
||||
// files: ["src/**/*.js"],
|
||||
ignores: [
|
||||
"dist/**/*.js",
|
||||
"!scripts/**/*.js"
|
||||
],
|
||||
},
|
||||
{
|
||||
languageOptions: { globals: { ...globals.browser, ...globals.node } },
|
||||
},
|
||||
pluginJs.configs.recommended,
|
||||
];
|
31
index.html
31
index.html
@ -1,31 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
|
||||
<title>БЕСПЛАТНЫЕ ПВЗ ОЗОН В ДНР</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" class="map"></div>
|
||||
<div id="popup" class="ol-popup">
|
||||
<a href="#" id="popup-closer" class="ol-popup-closer">✖</a>
|
||||
<div id="popup-content">
|
||||
<p id="popup-name"></p>
|
||||
<a id="popup-address"></a>
|
||||
<p>График работы: <span id="popup-operation-time">неизвестно</span></p>
|
||||
<p>
|
||||
Отсканируйте QR или нажмите на него
|
||||
<a id="popup-link" href="">
|
||||
<canvas id="popup-canvas"></canvas>
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a id="popup-source">Источник</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<script type="module" src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -323,28 +323,16 @@
|
||||
"source": "https://login.woyag.ru/map",
|
||||
"provider": "WOЯЖ"
|
||||
},
|
||||
{
|
||||
"coordinates": [
|
||||
37.775896,
|
||||
47.959707
|
||||
],
|
||||
"name": "Донецк 7 (микр-н Звездный)",
|
||||
"link": "https://ozon.ru/point/534953",
|
||||
"address": "Донецк, пр-кт Ленинский 98А",
|
||||
"operationTime": "пн-вс с 9:00 до 17:00",
|
||||
"source": "https://t.me/Mariupol_global_express/1989",
|
||||
"provider": "Global Express"
|
||||
},
|
||||
{
|
||||
"coordinates": [
|
||||
37.811995,
|
||||
48.011767
|
||||
],
|
||||
"name": "Донецк 8 (Крытый рынок)",
|
||||
"link": "https://ozon.ru/point/533323",
|
||||
"address": "Донецк, ул. 50-летия СССР 157А",
|
||||
"operationTime": "пн-пт с 9:00 до 17:00",
|
||||
"source": "https://t.me/Mariupol_global_express/1989",
|
||||
"name": "г. Донецк, ул. 50-летия СССР, 157А",
|
||||
"address": "г. Донецк, ул. 50-летия СССР, 157А",
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>",
|
||||
"source": "https://t.me/Mariupol_global_express/1977",
|
||||
"provider": "Global Express"
|
||||
},
|
||||
{
|
||||
@ -352,11 +340,23 @@
|
||||
37.799192,
|
||||
47.991666
|
||||
],
|
||||
"name": "Донецк 1 (Южный)",
|
||||
"link": "https://ozon.ru/point/533347",
|
||||
"address": "Донецк, площадь Коммунаров 1к1, ТЦ «Южный»",
|
||||
"operationTime": "пн-пт с 9:00 до 17:00, сб-вс с 10:00 ло 17:00",
|
||||
"source": "https://t.me/Mariupol_global_express/1989",
|
||||
"name": "г. Донецк, площадь Коммунаров 1к1, ТЦ «Южный»",
|
||||
"address": "г. Донецк, площадь Коммунаров 1к1, ТЦ «Южный»",
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>",
|
||||
"source": "https://t.me/Mariupol_global_express/1977",
|
||||
"provider": "Global Express"
|
||||
},
|
||||
{
|
||||
"coordinates": [
|
||||
37.775896,
|
||||
47.959707
|
||||
],
|
||||
"link": "https://ozon.ru/point/534953",
|
||||
"name": "г. Донецк, пр - кт Ленинский, 98Аостановка «Звездный»",
|
||||
"address": "г. Донецк, пр - кт Ленинский, 98Аостановка «Звездный»",
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>",
|
||||
"source": "https://t.me/Mariupol_global_express/1977",
|
||||
"provider": "Global Express"
|
||||
},
|
||||
{
|
||||
@ -364,11 +364,11 @@
|
||||
38.635921,
|
||||
48.047327
|
||||
],
|
||||
"name": "Торез 3",
|
||||
"link": "https://ozon.ru/point/533350",
|
||||
"name": "г. Торез, 4й микрорайон, (торговые павильоны в районе дома 23)",
|
||||
"address": "г. Торез, 4й микрорайон, (торговые павильоны в районе дома 23)",
|
||||
"operationTime": "пн-вс с 9:00 до 17:00",
|
||||
"source": "https://t.me/Mariupol_global_express/1989",
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>",
|
||||
"source": "https://t.me/Mariupol_global_express/1977",
|
||||
"provider": "Global Express"
|
||||
},
|
||||
{
|
||||
@ -376,11 +376,11 @@
|
||||
38.761523,
|
||||
48.021133
|
||||
],
|
||||
"name": "Снежное",
|
||||
"link": "https://ozon.ru/point/534920",
|
||||
"name": "Снежное, ул. Дзержинского, 2",
|
||||
"address": "Снежное, ул. Дзержинского, 2",
|
||||
"operationTime": "пн-вс с 9:00 до 17:00",
|
||||
"source": "https://t.me/Mariupol_global_express/1989",
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>",
|
||||
"source": "https://t.me/Mariupol_global_express/1977",
|
||||
"provider": "Global Express"
|
||||
},
|
||||
{
|
||||
@ -388,11 +388,11 @@
|
||||
38.208714,
|
||||
48.221055
|
||||
],
|
||||
"name": "Енакиево",
|
||||
"link": "https://ozon.ru/point/534903",
|
||||
"name": "Енакиево, проспект Ленина, 98в",
|
||||
"address": "Енакиево, проспект Ленина, 98в",
|
||||
"operationTime": "пн-вс с 9:00 до 17:00",
|
||||
"source": "https://t.me/Mariupol_global_express/1989",
|
||||
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>",
|
||||
"source": "https://t.me/Mariupol_global_express/1977",
|
||||
"provider": "Global Express"
|
||||
},
|
||||
{
|
||||
|
1018
package-lock.json
generated
1018
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -6,10 +6,15 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.4.0",
|
||||
"eslint": "^9.4.0",
|
||||
"globals": "^15.4.0",
|
||||
"vite": "^5.2.0",
|
||||
"vite-plugin-html-config": "^1.0.11",
|
||||
"vite-plugin-radar": "^0.9.6",
|
||||
"vite-plugin-webfont-dl": "^3.9.4"
|
||||
},
|
||||
|
@ -1,49 +1,15 @@
|
||||
import fs from "node:fs/promises";
|
||||
import { asyncMap } from "modern-async";
|
||||
import { getFinalURL } from "./utils.js";
|
||||
import ozonWbDpr from "./update/ozon-wb-dpr.js";
|
||||
import sevenDostavka from "./update/sevenDostavka.js";
|
||||
|
||||
async function woyag() {
|
||||
const apiResponse = await fetch("https://login.woyag.ru/ajax/pvz-list");
|
||||
const json = await apiResponse.json();
|
||||
|
||||
let points = json.filter((point) => !!point.link);
|
||||
|
||||
points = await asyncMap(points, async (point) => {
|
||||
const link = await getFinalURL(point.link).then(u => {
|
||||
const final = new URL(u);
|
||||
final.search = '';
|
||||
return final.toString();
|
||||
})
|
||||
|
||||
return {
|
||||
coordinates: [parseFloat(point["geo_lng"]), parseFloat(point["geo_lat"])],
|
||||
name: point.name,
|
||||
address: point.address,
|
||||
link,
|
||||
operationTime: "пн-вс с 9:00 до 17:45",
|
||||
};
|
||||
});
|
||||
|
||||
await fs.writeFile(
|
||||
"data/01_woyag.json",
|
||||
JSON.stringify(
|
||||
{
|
||||
name: "WOЯЖ",
|
||||
source: "https://login.woyag.ru/map",
|
||||
points,
|
||||
},
|
||||
undefined,
|
||||
4
|
||||
)
|
||||
);
|
||||
}
|
||||
import {
|
||||
woyag,
|
||||
sevenDostavka,
|
||||
ozonWbDpr,
|
||||
globalExpress
|
||||
} from './update/index.js';
|
||||
|
||||
async function main() {
|
||||
await woyag();
|
||||
await sevenDostavka();
|
||||
await ozonWbDpr();
|
||||
await globalExpress();
|
||||
}
|
||||
|
||||
main();
|
||||
|
190
scripts/update/globalExpress.js
Normal file
190
scripts/update/globalExpress.js
Normal file
@ -0,0 +1,190 @@
|
||||
import fs from "node:fs/promises";
|
||||
|
||||
import { JSDOM } from "jsdom";
|
||||
import { asyncMap } from "modern-async";
|
||||
import { getTelegramMessage } from "../utils.js";
|
||||
|
||||
const OUTPUT_FILE = "data/02_global-express.json";
|
||||
const MAIN_URL = "https://t.me/Mariupol_global_express/1977";
|
||||
|
||||
/*
|
||||
function generateReadableSchedule(schedule) {
|
||||
const dayMappings = {
|
||||
mon: "Пн",
|
||||
tue: "Вт",
|
||||
wed: "Ср",
|
||||
thu: "Чт",
|
||||
fri: "Пт",
|
||||
sat: "Сб",
|
||||
sun: "Вс",
|
||||
};
|
||||
|
||||
let readableSchedule = "";
|
||||
|
||||
Object.keys(dayMappings).forEach((key) => {
|
||||
const day = dayMappings[key];
|
||||
const daySchedule = schedule[key];
|
||||
|
||||
if (
|
||||
daySchedule &&
|
||||
daySchedule.open_time !== null &&
|
||||
daySchedule.close_time !== null
|
||||
) {
|
||||
const openTime = formatTime(daySchedule.open_time);
|
||||
const closeTime = formatTime(daySchedule.close_time);
|
||||
const breakStart = daySchedule.break_open_time
|
||||
? daySchedule.break_open_time
|
||||
: daySchedule.close_time;
|
||||
const breakEnd = daySchedule.break_close_time
|
||||
? daySchedule.break_close_time
|
||||
: daySchedule.close_time;
|
||||
|
||||
if (breakStart === daySchedule.close_time) {
|
||||
readableSchedule += `${day} ${openTime} - ${closeTime}\n`;
|
||||
} else {
|
||||
const breakStartFormatted = formatTime(breakStart);
|
||||
const breakEndFormatted = formatTime(breakEnd);
|
||||
readableSchedule += `${day} ${openTime} - ${breakStartFormatted}, ${breakEndFormatted} - ${closeTime}\n`;
|
||||
}
|
||||
} else {
|
||||
readableSchedule += `${day} Выходной\n`;
|
||||
}
|
||||
});
|
||||
|
||||
return readableSchedule.trim();
|
||||
}
|
||||
|
||||
function formatTime(minutes) {
|
||||
if (minutes < 0) return "00:00"; // Время меньше 0, возвращаем 00:00
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const mins = minutes % 60;
|
||||
return `${padZero(hours)}:${padZero(mins)}`;
|
||||
}
|
||||
|
||||
function padZero(num) {
|
||||
return num.toString().padStart(2, "0");
|
||||
}
|
||||
*/
|
||||
|
||||
async function getPVZFromPost(post) {
|
||||
const message = await getTelegramMessage(post);
|
||||
|
||||
const dom = new JSDOM(message.text);
|
||||
const document = dom.window.document;
|
||||
|
||||
// Ищем координаты, которые всегда в скобках, возможно с пробелами
|
||||
const coordinatesNode = Array.from(document.querySelectorAll("br"))
|
||||
.map((br) => br.nextSibling)
|
||||
.find(
|
||||
(node) =>
|
||||
node &&
|
||||
node.nodeType === 3 &&
|
||||
/\(\s*\d+(\.\d+)?\s*,\s*\d+(\.\d+)?\s*\)/.test(node.nodeValue.trim())
|
||||
);
|
||||
|
||||
let coordinates = null;
|
||||
if (coordinatesNode) {
|
||||
const matches = coordinatesNode.nodeValue.trim().match(/\(\s*([^)]*)\s*\)/);
|
||||
if (matches) {
|
||||
const [lat, lng] = matches[1]
|
||||
.split(",")
|
||||
.map((coord) => parseFloat(coord.trim()));
|
||||
coordinates = [lng, lat];
|
||||
}
|
||||
}
|
||||
|
||||
// Ищем ссылку, которая начинается с https://ozon.ru/point
|
||||
const linkNode = document.querySelector('a[href^="https://ozon.ru/point"]');
|
||||
const link = linkNode ? linkNode.href : null;
|
||||
|
||||
return {
|
||||
coordinates,
|
||||
link,
|
||||
};
|
||||
}
|
||||
|
||||
async function getFromTelegram() {
|
||||
const message = await getTelegramMessage(MAIN_URL);
|
||||
|
||||
const dom = new JSDOM(message.text);
|
||||
const document = dom.window.document;
|
||||
|
||||
const addressesSection = Array.from(document.querySelectorAll("b")).find(
|
||||
(b) => b.textContent.includes("Наши адреса ПВЗ с OZON")
|
||||
);
|
||||
const privilegesSection = Array.from(document.querySelectorAll("u")).find(
|
||||
(u) => u.textContent.includes("Какие привилегии")
|
||||
);
|
||||
|
||||
const links = [];
|
||||
let currentElement = addressesSection.nextElementSibling;
|
||||
|
||||
while (currentElement && currentElement !== privilegesSection) {
|
||||
if (currentElement.tagName === "A") {
|
||||
links.push(currentElement);
|
||||
}
|
||||
currentElement = currentElement.nextElementSibling;
|
||||
}
|
||||
|
||||
const data = await asyncMap(links, async (link) => {
|
||||
const textContent = link.textContent;
|
||||
|
||||
const pvzData = await getPVZFromPost(link.href);
|
||||
|
||||
return {
|
||||
...pvzData,
|
||||
name: textContent,
|
||||
address: textContent,
|
||||
};
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/*
|
||||
async function getFromVK() {
|
||||
const group_id = 124759560;
|
||||
const access_token = "";
|
||||
const v = "5.199";
|
||||
|
||||
const res = await fetch(
|
||||
`https://api.vk.com/method/groups.getAddresses?group_id=${group_id}&access_token=${access_token}&count=999&v=${v}`,
|
||||
{
|
||||
headers: {
|
||||
"Accept-Language": "ru,en;q=0.9",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const items = (await res.json()).response.items;
|
||||
|
||||
return items.map((item) => ({
|
||||
address: `${item.city.title}, ${item.address}`,
|
||||
timetable: item.timetable,
|
||||
}));
|
||||
}
|
||||
*/
|
||||
|
||||
async function globalExpress() {
|
||||
const points = await getFromTelegram();
|
||||
// const points = await getFromVK();
|
||||
|
||||
fs.writeFile(
|
||||
OUTPUT_FILE,
|
||||
JSON.stringify(
|
||||
{
|
||||
name: "Global Express",
|
||||
source: MAIN_URL,
|
||||
points: points.map((p) => ({
|
||||
...p,
|
||||
operationTime:
|
||||
`<a href="https://vk.com/aliexpress___delivery?w=address-124759560_72654">ГРАФИК РАБОТЫ</a>`,
|
||||
})),
|
||||
},
|
||||
undefined,
|
||||
4
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default globalExpress;
|
@ -0,0 +1,4 @@
|
||||
export { default as woyag } from "./woyag.js";
|
||||
export { default as ozonWbDpr } from "./ozon-wb-dpr.js";
|
||||
export { default as sevenDostavka } from "./sevenDostavka.js";
|
||||
export { default as globalExpress } from "./globalExpress.js";
|
@ -4,6 +4,8 @@ import { JSDOM } from "jsdom";
|
||||
import { asyncMap } from "modern-async";
|
||||
import fs from "node:fs/promises";
|
||||
|
||||
const OUTPUT_FILE = "data/03_ozon-wb-dpr.json";
|
||||
|
||||
const MAIN_URL = "https://t.me/ozon_wb_dpr/627";
|
||||
|
||||
const QR_FOR_PVZ_STRING = "QR для ПВЗ";
|
||||
@ -108,7 +110,7 @@ async function ozonWbDpr() {
|
||||
});
|
||||
|
||||
await fs.writeFile(
|
||||
"data/03_ozon-wb-dpr.json",
|
||||
OUTPUT_FILE,
|
||||
JSON.stringify(
|
||||
{
|
||||
name: "ПВЗ ДНР",
|
||||
|
@ -1,6 +1,8 @@
|
||||
import fs from "node:fs/promises";
|
||||
import { JSDOM } from "jsdom";
|
||||
|
||||
const OUTPUT_FILE = "data/99_sevenDostavka.json";
|
||||
|
||||
const linkRegexp = new RegExp(/https:\/\/ozon\.ru\/point\/\d+/);
|
||||
|
||||
async function sevenDostavka() {
|
||||
@ -19,7 +21,7 @@ async function sevenDostavka() {
|
||||
const points = new Function(`return [{${x}}]`)();
|
||||
|
||||
fs.writeFile(
|
||||
"data/99_sevenDostavka.json",
|
||||
OUTPUT_FILE,
|
||||
JSON.stringify(
|
||||
{
|
||||
name: "7dostavka",
|
||||
|
43
scripts/update/woyag.js
Normal file
43
scripts/update/woyag.js
Normal file
@ -0,0 +1,43 @@
|
||||
import fs from "node:fs/promises";
|
||||
import { asyncMap } from "modern-async";
|
||||
import { getFinalURL } from "../utils.js";
|
||||
|
||||
const OUTPUT_FILE = "data/01_woyag.json";
|
||||
|
||||
async function woyag() {
|
||||
const apiResponse = await fetch("https://login.woyag.ru/ajax/pvz-list");
|
||||
const json = await apiResponse.json();
|
||||
|
||||
let points = json.filter((point) => !!point.link);
|
||||
|
||||
points = await asyncMap(points, async (point) => {
|
||||
const link = await getFinalURL(point.link).then(u => {
|
||||
const final = new URL(u);
|
||||
final.search = '';
|
||||
return final.toString();
|
||||
})
|
||||
|
||||
return {
|
||||
coordinates: [parseFloat(point["geo_lng"]), parseFloat(point["geo_lat"])],
|
||||
name: point.name,
|
||||
address: point.address,
|
||||
link,
|
||||
operationTime: "пн-вс с 9:00 до 17:45",
|
||||
};
|
||||
});
|
||||
|
||||
await fs.writeFile(
|
||||
OUTPUT_FILE,
|
||||
JSON.stringify(
|
||||
{
|
||||
name: "WOЯЖ",
|
||||
source: "https://login.woyag.ru/map",
|
||||
points,
|
||||
},
|
||||
undefined,
|
||||
4
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default woyag
|
57
src/index.html
Normal file
57
src/index.html
Normal file
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<title>БЕСПЛАТНЫЕ ПВЗ ОЗОН В ДНР</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Бесплатные ПВЗ Озон в ДНР. Найдите ближайший пункт выдачи заказов Озон и воспользуйтесь бесплатной доставкой в ДНР."
|
||||
/>
|
||||
<meta
|
||||
name="keywords"
|
||||
content="ПВЗ Озон, бесплатная доставка, ДНР, пункты выдачи заказов, Озон ДНР"
|
||||
/>
|
||||
<meta property="og:title" content="БЕСПЛАТНЫЕ ПВЗ ОЗОН В ДНР" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="Найдите ближайший пункт выдачи заказов Озон в ДНР и воспользуйтесь бесплатной доставкой."
|
||||
/>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:image" content="https://cdn1.ozone.ru/s3/cms/logo/og_ozon_ru.png" />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Roboto&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<style>
|
||||
#popup {
|
||||
display: none;
|
||||
}
|
||||
.ol-overlay-container > #popup {
|
||||
display: unset;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" class="map"></div>
|
||||
<div id="popup" class="ol-popup">
|
||||
<a href="#" id="popup-closer" class="ol-popup-closer">✖</a>
|
||||
<div id="popup-content">
|
||||
<p id="popup-name"></p>
|
||||
<a id="popup-address"></a>
|
||||
<p>График работы: <span id="popup-operation-time">неизвестно</span></p>
|
||||
<p>
|
||||
Отсканируйте QR или нажмите на него
|
||||
<a id="popup-link" href="">
|
||||
<canvas id="popup-canvas"></canvas>
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a id="popup-source">Источник</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<script type="module" src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -4,7 +4,7 @@ import map from "./map";
|
||||
|
||||
import "./popup";
|
||||
|
||||
import mergedData from "./merged-data.json";
|
||||
import mergedData from "../merged-data.json";
|
||||
import { createFeatures } from "./features";
|
||||
import VectorSource from "ol/source/Vector";
|
||||
import VectorLayer from "ol/layer/Vector";
|
@ -4,7 +4,7 @@ import View from 'ol/View';
|
||||
import TileLayer from 'ol/layer/Tile';
|
||||
import { fromLonLat } from 'ol/proj';
|
||||
import { XYZ } from 'ol/source';
|
||||
import { createXYZ } from 'ol/tilegrid';
|
||||
// import { createXYZ } from 'ol/tilegrid';
|
||||
|
||||
const MAP_TARGET = 'map';
|
||||
const MAP_CENTER = fromLonLat([37.57725139554275, 48.02287702854201]);
|
@ -4,7 +4,7 @@ import QRCode from "qrcode";
|
||||
import { el } from "./utils";
|
||||
import { toLonLat } from "ol/proj";
|
||||
|
||||
const container = el("popup");
|
||||
const popup = el("popup");
|
||||
const closer = el("popup-closer");
|
||||
|
||||
const popupName = el("popup-name");
|
||||
@ -15,7 +15,7 @@ const popupSource = el("popup-source");
|
||||
const popupOperationTime = el("popup-operation-time");
|
||||
|
||||
const overlay = new Overlay({
|
||||
element: container,
|
||||
element: popup,
|
||||
autoPan: true,
|
||||
autoPanAnimation: {
|
||||
duration: 250,
|
||||
@ -46,7 +46,7 @@ function onClick(event) {
|
||||
popupAddress.href = `https://yandex.ru/maps/?whatshere[point]=${lon},${lat}&whatshere[zoom]=18&l=map`
|
||||
popupLink.href = feature.get("link");
|
||||
popupSource.href = feature.get("source");
|
||||
popupOperationTime.textContent = feature.get("operationTime") ?? "неизвестно";
|
||||
popupOperationTime.innerHTML = feature.get("operationTime") ?? "неизвестно";
|
||||
|
||||
QRCode.toCanvas(popupCanvas, feature.get("link"), function (error) {
|
||||
if (error) console.error(error);
|
@ -1,13 +1,40 @@
|
||||
import webfontDownload from 'vite-plugin-webfont-dl';
|
||||
import { VitePluginRadar } from 'vite-plugin-radar'
|
||||
import webfontDownload from "vite-plugin-webfont-dl";
|
||||
import { VitePluginRadar } from "vite-plugin-radar";
|
||||
import htmlPlugin from 'vite-plugin-html-config'
|
||||
|
||||
const metas = []
|
||||
|
||||
if (process.env.YANDEX_VERIFICATION) {
|
||||
metas.push({
|
||||
name: 'yandex-verification',
|
||||
content: process.env.YANDEX_VERIFICATION
|
||||
})
|
||||
}
|
||||
|
||||
const PUBLIC_URL = process.env.PUBLIC_URL || process.env.VERCEL_PROJECT_PRODUCTION_URL
|
||||
|
||||
if (PUBLIC_URL) {
|
||||
metas.push({
|
||||
name: 'og:url',
|
||||
content: 'https://' + PUBLIC_URL
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
root: "src",
|
||||
build: {
|
||||
outDir: "../dist",
|
||||
},
|
||||
plugins: [
|
||||
webfontDownload(),
|
||||
VitePluginRadar({
|
||||
metrica: {
|
||||
id: process.env.YANDEX_METRICA_ID
|
||||
id: process.env.YANDEX_METRICA_ID,
|
||||
},
|
||||
})
|
||||
}),
|
||||
htmlPlugin({
|
||||
metas,
|
||||
},)
|
||||
],
|
||||
};
|
Loading…
Reference in New Issue
Block a user