almtools 2.0.8 → 3.0.0
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/README.md +14 -17
- package/fonts/Quicksilver.otf +0 -0
- package/index.js +13 -3
- package/lib/asset.js +170 -0
- package/lib/createThumbnail.js +138 -1
- package/lib/orderbook.js +182 -0
- package/lib/qc.js +446 -1
- package/lib/soal.json +2071 -0
- package/lib/tools.js +47 -38
- package/package.json +7 -5
package/lib/tools.js
CHANGED
|
@@ -23,11 +23,11 @@ async function getBuffer(url) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async function tiktok(tiktokUrl) {
|
|
26
|
-
const { token, cookie } = await getTokenAndCookie()
|
|
26
|
+
const { token, cookie } = await getTokenAndCookie();
|
|
27
27
|
|
|
28
|
-
const params = new URLSearchParams()
|
|
29
|
-
params.append('url', tiktokUrl)
|
|
30
|
-
params.append('token', token)
|
|
28
|
+
const params = new URLSearchParams();
|
|
29
|
+
params.append('url', tiktokUrl);
|
|
30
|
+
params.append('token', token);
|
|
31
31
|
|
|
32
32
|
const res = await axios.post('https://tmate.cc/action', params.toString(), {
|
|
33
33
|
headers: {
|
|
@@ -37,62 +37,71 @@ async function tiktok(tiktokUrl) {
|
|
|
37
37
|
'Origin': 'https://tmate.cc',
|
|
38
38
|
'Cookie': cookie
|
|
39
39
|
}
|
|
40
|
-
})
|
|
40
|
+
});
|
|
41
41
|
|
|
42
|
-
const html = res.data?.data
|
|
43
|
-
if (!html) throw new Error('ga ada data')
|
|
42
|
+
const html = res.data?.data;
|
|
43
|
+
if (!html) throw new Error('ga ada data');
|
|
44
44
|
|
|
45
|
-
const titleMatch = html.match(/<h1[^>]*>(.*?)<\/h1>/i)
|
|
46
|
-
const title = titleMatch?.[1]?.replace(/<[^>]+>/g, '').trim() || 'Tanpa Judul'
|
|
45
|
+
const titleMatch = html.match(/<h1[^>]*>(.*?)<\/h1>/i);
|
|
46
|
+
const title = titleMatch?.[1]?.replace(/<[^>]+>/g, '').trim() || 'Tanpa Judul';
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
// === STEP 1: Coba ambil gambar dari dlpanda.com ===
|
|
49
|
+
const dlpandaRes = await axios.get(`https://dlpanda.com/id?token=hy5EGGKC&url=${encodeURIComponent(tiktokUrl)}`, {
|
|
50
|
+
headers: {
|
|
51
|
+
'User-Agent': 'Mozilla/5.0'
|
|
52
|
+
}
|
|
53
|
+
});
|
|
53
54
|
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const mp3Link = links.find(v => /download mp3 audio/i.test(v.label))?.href
|
|
55
|
+
const $ = cheerio.load(dlpandaRes.data);
|
|
56
|
+
const imageUrls = [];
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
$('.col-md-12.col-lg-6 img').each((i, el) => {
|
|
59
|
+
const src = $(el).attr('src');
|
|
60
|
+
if (src && src.startsWith('http')) {
|
|
61
|
+
imageUrls.push(src);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (imageUrls.length > 0) {
|
|
66
|
+
const audioMatch = html.match(/<a[^>]+href="(https:\/\/[^"]+)"[^>]*>\s*<span>\s*<span>Download MP3 Audio<\/span><\/span><\/a>/i);
|
|
67
|
+
const mp3Link = audioMatch?.[1];
|
|
64
68
|
|
|
65
69
|
return {
|
|
66
70
|
status: true,
|
|
67
71
|
result: {
|
|
68
|
-
mediatype: '
|
|
69
|
-
media:
|
|
70
|
-
mediaHd: mediaHdBuffer,
|
|
72
|
+
mediatype: 'image',
|
|
73
|
+
media: imageUrls,
|
|
71
74
|
title,
|
|
72
|
-
audio:
|
|
75
|
+
audio: mp3Link
|
|
73
76
|
}
|
|
74
|
-
}
|
|
77
|
+
};
|
|
75
78
|
}
|
|
76
79
|
|
|
77
|
-
|
|
78
|
-
const
|
|
80
|
+
// === STEP 2: Jika tidak ada gambar, fallback ke video ===
|
|
81
|
+
const matches = [...html.matchAll(/<a[^>]+href="(https:\/\/[^"]+)"[^>]*>\s*<span>\s*<span>([^<]*)<\/span><\/span><\/a>/gi)];
|
|
82
|
+
const seen = new Set();
|
|
83
|
+
const links = matches
|
|
84
|
+
.map(([_, href, label]) => ({ href, label: label.trim() }))
|
|
85
|
+
.filter(({ href }) => !href.includes('play.google.com') && !seen.has(href) && seen.add(href));
|
|
79
86
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
87
|
+
const mp4Link = links.find(v => /download without watermark/i.test(v.label))?.href;
|
|
88
|
+
const mp4HdLink = links.find(v => /download hd/i.test(v.label))?.href || mp4Link;
|
|
89
|
+
const mp3Link = links.find(v => /download mp3 audio/i.test(v.label))?.href;
|
|
83
90
|
|
|
91
|
+
if (mp4Link) {
|
|
84
92
|
return {
|
|
85
93
|
status: true,
|
|
86
94
|
result: {
|
|
87
|
-
mediatype: '
|
|
88
|
-
media:
|
|
95
|
+
mediatype: 'video',
|
|
96
|
+
media: mp4Link,
|
|
97
|
+
mediaHd: mp4HdLink,
|
|
89
98
|
title,
|
|
90
|
-
audio:
|
|
99
|
+
audio: mp3Link
|
|
91
100
|
}
|
|
92
|
-
}
|
|
101
|
+
};
|
|
93
102
|
}
|
|
94
103
|
|
|
95
|
-
throw new Error('ga ada respon, mungkin link salah')
|
|
104
|
+
throw new Error('ga ada respon, mungkin link salah');
|
|
96
105
|
}
|
|
97
106
|
|
|
98
107
|
async function instagram(url) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "almtools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Tools Downloader For WhatsApp Bot",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
"tools"
|
|
13
13
|
],
|
|
14
14
|
"author": "Nezzx",
|
|
15
|
-
"license": "
|
|
15
|
+
"license": "UNLICENSED",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"axios": "^1.7.3",
|
|
18
|
-
"cheerio": "^1.0.0",
|
|
19
|
-
"qs": "^6.13.0",
|
|
20
18
|
"canvas": "^3.1.0",
|
|
21
|
-
"
|
|
19
|
+
"cheerio": "^1.0.0",
|
|
20
|
+
"events": "^3.3.0",
|
|
21
|
+
"jimp": "^0.16.3",
|
|
22
|
+
"path": "^0.12.7",
|
|
23
|
+
"qs": "^6.13.0"
|
|
22
24
|
}
|
|
23
25
|
}
|