@soyaxell09/zenbot-scraper 1.0.4 → 1.0.5
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/package.json +1 -1
- package/src/index.js +1 -0
- package/src/scrapers/index.js +1 -7
- package/src/scrapers/stickers.js +101 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soyaxell09/zenbot-scraper",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Scrapers de descarga y búsqueda para bots de WhatsApp — YouTube, TikTok, Facebook, Twitter, Pinterest, MediaFire, GitHub, APK y más.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { tweetInfo, tweetDownload } from './scrap
|
|
|
13
13
|
export { mediafireInfo } from './scrapers/mediafire.js'
|
|
14
14
|
export { githubInfo, githubRelease, githubContents, githubSearch } from './scrapers/github.js'
|
|
15
15
|
export { apkSearch, apkInfo } from './scrapers/apk.js'
|
|
16
|
+
export { stickerSearch, stickerPack } from './scrapers/stickers.js'
|
|
16
17
|
export { googleSearch } from './search/google.js'
|
|
17
18
|
export { spotify } from './search/spotify.js'
|
|
18
19
|
export { giphy } from './search/giphy.js'
|
package/src/scrapers/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* © Created by AxelDev09 🔥
|
|
3
|
-
* GitHub: https://github.com/AxelDev09
|
|
4
|
-
* Instagram: @axeldev09
|
|
5
|
-
* Deja los créditos we 🗣️
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
1
|
export { ytInfo, ytDownload, ytSearch } from './youtube.js'
|
|
9
2
|
export { ytInfoV2, ytDownloadV2, getFileSizeV2 } from './youtubev2.js'
|
|
10
3
|
export { tiktokInfo, tiktokDownload } from './tiktok.js'
|
|
@@ -13,3 +6,4 @@ export { tweetInfo, tweetDownload } from './twitter
|
|
|
13
6
|
export { mediafireInfo } from './mediafire.js'
|
|
14
7
|
export { githubInfo, githubRelease, githubContents, githubSearch } from './github.js'
|
|
15
8
|
export { apkSearch, apkInfo } from './apk.js'
|
|
9
|
+
export { stickerSearch, stickerPack } from './stickers.js'
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* © Created by AxelDev09 🔥
|
|
3
|
+
* GitHub: https://github.com/AxelDev09
|
|
4
|
+
* Instagram: @axeldev09
|
|
5
|
+
* Deja los créditos we 🗣️
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import axios from 'axios'
|
|
9
|
+
import * as cheerio from 'cheerio'
|
|
10
|
+
|
|
11
|
+
const HEADERS = {
|
|
12
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36',
|
|
13
|
+
}
|
|
14
|
+
const BASE = 'https://stickerscloud.com'
|
|
15
|
+
|
|
16
|
+
function extractPackId(url) {
|
|
17
|
+
const m = url.match(/\/pack\/([^/?#]+)/)
|
|
18
|
+
return m ? m[1] : null
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function stickerSearch(query, limit = 10) {
|
|
22
|
+
if (!query?.trim()) throw new Error('Query vacío')
|
|
23
|
+
|
|
24
|
+
const res = await axios.get(
|
|
25
|
+
`${BASE}/search?q=${encodeURIComponent(query)}`,
|
|
26
|
+
{ headers: HEADERS, timeout: 15000 }
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const $ = cheerio.load(res.data)
|
|
30
|
+
const results = []
|
|
31
|
+
const seen = new Set()
|
|
32
|
+
|
|
33
|
+
$('a[href*="/pack/"]').each((_, el) => {
|
|
34
|
+
if (results.length >= limit) return false
|
|
35
|
+
const href = $(el).attr('href') || ''
|
|
36
|
+
const packId = extractPackId(href)
|
|
37
|
+
if (!packId || seen.has(packId)) return
|
|
38
|
+
seen.add(packId)
|
|
39
|
+
|
|
40
|
+
const name = $(el).text().trim() || packId
|
|
41
|
+
const preview = $(el).find('img').first().attr('src')
|
|
42
|
+
|| $(el).closest('[class]').find('img[src*="stickers.cloud"]').first().attr('src')
|
|
43
|
+
|| ''
|
|
44
|
+
|
|
45
|
+
if (!name || name.startsWith('#') === false && name.length < 2) return
|
|
46
|
+
|
|
47
|
+
const cleanName = decodeURIComponent(
|
|
48
|
+
(name.replace(/^#\d+\s*/, '').trim() || packId)
|
|
49
|
+
.replace(/-/g, ' ')
|
|
50
|
+
.replace(/\b\w/g, l => l.toUpperCase())
|
|
51
|
+
)
|
|
52
|
+
results.push({
|
|
53
|
+
packId,
|
|
54
|
+
name: cleanName,
|
|
55
|
+
url: `${BASE}/en/pack/${packId}`,
|
|
56
|
+
preview: preview || '',
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
if (!results.length) throw new Error('Sin resultados para: ' + query)
|
|
61
|
+
return results
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function stickerPack(packIdOrUrl, limit = 30) {
|
|
65
|
+
const packId = packIdOrUrl.includes('stickerscloud.com')
|
|
66
|
+
? extractPackId(packIdOrUrl)
|
|
67
|
+
: packIdOrUrl
|
|
68
|
+
|
|
69
|
+
if (!packId) throw new Error('Pack ID o URL inválida')
|
|
70
|
+
|
|
71
|
+
const res = await axios.get(
|
|
72
|
+
`${BASE}/en/pack/${packId}`,
|
|
73
|
+
{ headers: HEADERS, timeout: 15000 }
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
const $ = cheerio.load(res.data)
|
|
77
|
+
const stickers = []
|
|
78
|
+
const seen = new Set()
|
|
79
|
+
|
|
80
|
+
$('img[src*="stickers.cloud"]').each((_, el) => {
|
|
81
|
+
if (stickers.length >= limit) return false
|
|
82
|
+
const src = $(el).attr('src') || ''
|
|
83
|
+
if (!src || seen.has(src)) return
|
|
84
|
+
seen.add(src)
|
|
85
|
+
stickers.push(src)
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
const name = decodeURIComponent(packId)
|
|
89
|
+
.replace(/-/g, ' ')
|
|
90
|
+
.replace(/\b\w/g, l => l.toUpperCase())
|
|
91
|
+
|
|
92
|
+
if (!stickers.length) throw new Error('No se encontraron stickers en ese pack')
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
packId,
|
|
96
|
+
name,
|
|
97
|
+
url: `${BASE}/en/pack/${packId}`,
|
|
98
|
+
total: stickers.length,
|
|
99
|
+
stickers,
|
|
100
|
+
}
|
|
101
|
+
}
|