0
0
mirror of https://github.com/Maks1mS/free-ozon-dpr.git synced 2024-12-23 18:42:59 +03:00

fix globalExpress newline

This commit is contained in:
Maxim Slipenko 2024-06-22 23:16:49 +03:00
parent f6b26f049f
commit cdba0bfa16
5 changed files with 24 additions and 11 deletions

View File

@ -28,8 +28,8 @@
47.959707 47.959707
], ],
"link": "https://ozon.ru/point/534953", "link": "https://ozon.ru/point/534953",
"name": "г. Донецк, пр - кт Ленинский, 98Аостановка «Звездный»", "name": "г. Донецк, пр - кт Ленинский, 98А остановка «Звездный»",
"address": "г. Донецк, пр - кт Ленинский, 98Аостановка «Звездный»", "address": "г. Донецк, пр - кт Ленинский, 98А остановка «Звездный»",
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>" "operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>"
}, },
{ {

View File

@ -353,8 +353,8 @@
37.775896, 37.775896,
47.959707 47.959707
], ],
"name": "г. Донецк, пр - кт Ленинский, 98Аостановка «Звездный»", "name": "г. Донецк, пр - кт Ленинский, 98А остановка «Звездный»",
"address": "г. Донецк, пр - кт Ленинский, 98Аостановка «Звездный»", "address": "г. Донецк, пр - кт Ленинский, 98А остановка «Звездный»",
"operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>", "operationTime": "<a href=\"https://vk.com/aliexpress___delivery?w=address-124759560_72654\">ГРАФИК РАБОТЫ</a>",
"source": "https://t.me/Mariupol_global_express/1977", "source": "https://t.me/Mariupol_global_express/1977",
"provider": "Global Express" "provider": "Global Express"

17
package-lock.json generated
View File

@ -19,6 +19,7 @@
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.4.0", "@eslint/js": "^9.4.0",
"collapse-white-space": "^2.1.0",
"eslint": "^9.4.0", "eslint": "^9.4.0",
"globals": "^15.4.0", "globals": "^15.4.0",
"vite": "^5.2.0", "vite": "^5.2.0",
@ -1093,6 +1094,16 @@
"wrap-ansi": "^6.2.0" "wrap-ansi": "^6.2.0"
} }
}, },
"node_modules/collapse-white-space": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.1.0.tgz",
"integrity": "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==",
"dev": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/color-convert": { "node_modules/color-convert": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@ -3238,9 +3249,9 @@
"dev": true "dev": true
}, },
"node_modules/ws": { "node_modules/ws": {
"version": "8.17.0", "version": "8.17.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
"integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"engines": { "engines": {
"node": ">=10.0.0" "node": ">=10.0.0"
}, },

View File

@ -11,6 +11,7 @@
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.4.0", "@eslint/js": "^9.4.0",
"collapse-white-space": "^2.1.0",
"eslint": "^9.4.0", "eslint": "^9.4.0",
"globals": "^15.4.0", "globals": "^15.4.0",
"vite": "^5.2.0", "vite": "^5.2.0",

View File

@ -3,6 +3,7 @@ import fs from "node:fs/promises";
import { JSDOM } from "jsdom"; import { JSDOM } from "jsdom";
import { asyncMap } from "modern-async"; import { asyncMap } from "modern-async";
import { getTelegramMessage } from "../utils.js"; import { getTelegramMessage } from "../utils.js";
import { collapseWhiteSpace } from "collapse-white-space";
const OUTPUT_FILE = "data/02_global-express.json"; const OUTPUT_FILE = "data/02_global-express.json";
const MAIN_URL = "https://t.me/Mariupol_global_express/1977"; const MAIN_URL = "https://t.me/Mariupol_global_express/1977";
@ -127,8 +128,9 @@ async function getFromTelegram() {
} }
const data = await asyncMap(links, async (link) => { const data = await asyncMap(links, async (link) => {
const textContent = link.textContent; const textContent = collapseWhiteSpace(
link.innerHTML.replace(/<br\s*\/?>/gi, " ")
);
const pvzData = await getPVZFromPost(link.href); const pvzData = await getPVZFromPost(link.href);
return { return {
@ -177,8 +179,7 @@ async function globalExpress() {
source: MAIN_URL, source: MAIN_URL,
points: points.map((p) => ({ points: points.map((p) => ({
...p, ...p,
operationTime: operationTime: `<a href="https://vk.com/aliexpress___delivery?w=address-124759560_72654">ГРАФИК РАБОТЫ</a>`,
`<a href="https://vk.com/aliexpress___delivery?w=address-124759560_72654">ГРАФИК РАБОТЫ</a>`,
})), })),
}, },
undefined, undefined,