@afilimax/message-text-parser 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/parsers/ofertas-adrenaline.parser.js +1 -1
- package/dist/parsers/pc-do-fafa.parser.js +1 -1
- package/dist/parsers/promocoes-do-tec.parser.js +5 -8
- package/dist/parsers/skandar-souza-promocoes.parser.js +1 -1
- package/dist/parsers/tj-gaming.parser.js +1 -1
- package/dist/utils/collapse-white-space.util.js +1 -3
- package/dist/utils/money.util.js +1 -1
- package/package.json +45 -45
|
@@ -23,7 +23,7 @@ exports.pcDoFafaParser = {
|
|
|
23
23
|
return {
|
|
24
24
|
title: (0, utils_1.collapseWhiteSpaces)((0, utils_1.removeEmojis)(titleMatch[1])),
|
|
25
25
|
price: {
|
|
26
|
-
value: (0, utils_1.parseBrl)(priceMatch[1])
|
|
26
|
+
value: (0, utils_1.parseBrl)(priceMatch[1]),
|
|
27
27
|
oldValue: null,
|
|
28
28
|
currency: "BRL",
|
|
29
29
|
},
|
|
@@ -12,8 +12,7 @@ exports.promocoesDoTecParser = {
|
|
|
12
12
|
if ((context === null || context === void 0 ? void 0 : context.channelId) && context.channelId === ((_a = this.meta) === null || _a === void 0 ? void 0 : _a.telegramChannelId)) {
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
15
|
-
if (text.toLowerCase().includes("resgate aqui") &&
|
|
16
|
-
!text.includes("💲")) {
|
|
15
|
+
if (text.toLowerCase().includes("resgate aqui") && !text.includes("💲")) {
|
|
17
16
|
return false;
|
|
18
17
|
}
|
|
19
18
|
return true;
|
|
@@ -21,13 +20,11 @@ exports.promocoesDoTecParser = {
|
|
|
21
20
|
parse(text) {
|
|
22
21
|
const lines = text
|
|
23
22
|
.split("\n")
|
|
24
|
-
.map(l => l.trim())
|
|
23
|
+
.map((l) => l.trim())
|
|
25
24
|
.filter(Boolean);
|
|
26
25
|
if (!lines.length)
|
|
27
26
|
return null;
|
|
28
|
-
const title = lines[0]
|
|
29
|
-
.replace(/^🚨\s*/g, "")
|
|
30
|
-
.trim();
|
|
27
|
+
const title = lines[0].replace(/^🚨\s*/g, "").trim();
|
|
31
28
|
const priceMatch = text.match(/💲\s*R\$\s*([\d.,]+)/i);
|
|
32
29
|
const urlMatch = text.match(/https?:\/\/[^\s]+/i);
|
|
33
30
|
if (!priceMatch || !urlMatch)
|
|
@@ -36,12 +33,12 @@ exports.promocoesDoTecParser = {
|
|
|
36
33
|
return {
|
|
37
34
|
title: (0, utils_1.collapseWhiteSpaces)((0, utils_1.removeEmojis)(title)),
|
|
38
35
|
price: {
|
|
39
|
-
value: (0, utils_1.parseBrl)(priceMatch[1])
|
|
36
|
+
value: (0, utils_1.parseBrl)(priceMatch[1]),
|
|
40
37
|
currency: "BRL",
|
|
41
38
|
oldValue: null,
|
|
42
39
|
},
|
|
43
40
|
url: urlMatch[0],
|
|
44
41
|
coupons: coupons,
|
|
45
42
|
};
|
|
46
|
-
}
|
|
43
|
+
},
|
|
47
44
|
};
|
|
@@ -23,7 +23,7 @@ exports.tjGamingParser = {
|
|
|
23
23
|
return {
|
|
24
24
|
title: (0, utils_1.collapseWhiteSpaces)((0, utils_1.removeEmojis)(titleMatch[1])),
|
|
25
25
|
price: {
|
|
26
|
-
value: (0, utils_1.parseBrl)(priceMatch[1])
|
|
26
|
+
value: (0, utils_1.parseBrl)(priceMatch[1]),
|
|
27
27
|
oldValue: null,
|
|
28
28
|
currency: "BRL",
|
|
29
29
|
},
|
package/dist/utils/money.util.js
CHANGED
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@afilimax/message-text-parser",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Esta é uma biblioteca focada em extrair dados de mensagens de ofertas enviadas por canais do Telegram brasileiros.",
|
|
5
|
-
"type": "commonjs",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
10
|
-
"dist/*",
|
|
11
|
-
"!/**/__tests__"
|
|
12
|
-
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "tsc",
|
|
15
|
-
"dev": "ts-node ./src/index.ts",
|
|
16
|
-
"format": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
|
17
|
-
"test": "jest"
|
|
18
|
-
},
|
|
19
|
-
"publishConfig": {
|
|
20
|
-
"access": "public"
|
|
21
|
-
},
|
|
22
|
-
"keywords": [
|
|
23
|
-
"afilimax",
|
|
24
|
-
"offer parser",
|
|
25
|
-
"telegram message"
|
|
26
|
-
],
|
|
27
|
-
"author": "Marcuth",
|
|
28
|
-
"license": "MIT",
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@types/jest": "^30.0.0",
|
|
31
|
-
"@types/node": "^25.2.3",
|
|
32
|
-
"eslint": "^10.0.0",
|
|
33
|
-
"eslint-config-prettier": "^10.1.8",
|
|
34
|
-
"eslint-plugin-prettier": "^5.5.5",
|
|
35
|
-
"jest": "^30.2.0",
|
|
36
|
-
"prettier": "^3.8.1",
|
|
37
|
-
"prettier-plugin-sort-imports": "^1.8.10",
|
|
38
|
-
"ts-jest": "^29.4.6",
|
|
39
|
-
"ts-node": "^10.9.2",
|
|
40
|
-
"typescript": "^5.9.3"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"zod": "^4.3.6"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@afilimax/message-text-parser",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Esta é uma biblioteca focada em extrair dados de mensagens de ofertas enviadas por canais do Telegram brasileiros.",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/*",
|
|
11
|
+
"!/**/__tests__"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "ts-node ./src/index.ts",
|
|
16
|
+
"format": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
|
17
|
+
"test": "jest"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"afilimax",
|
|
24
|
+
"offer parser",
|
|
25
|
+
"telegram message"
|
|
26
|
+
],
|
|
27
|
+
"author": "Marcuth",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/jest": "^30.0.0",
|
|
31
|
+
"@types/node": "^25.2.3",
|
|
32
|
+
"eslint": "^10.0.0",
|
|
33
|
+
"eslint-config-prettier": "^10.1.8",
|
|
34
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
35
|
+
"jest": "^30.2.0",
|
|
36
|
+
"prettier": "^3.8.1",
|
|
37
|
+
"prettier-plugin-sort-imports": "^1.8.10",
|
|
38
|
+
"ts-jest": "^29.4.6",
|
|
39
|
+
"ts-node": "^10.9.2",
|
|
40
|
+
"typescript": "^5.9.3"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"zod": "^4.3.6"
|
|
44
|
+
}
|
|
45
|
+
}
|