@soyaxell09/zenbot-scraper 1.0.5 → 1.0.8

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 CHANGED
@@ -1,11 +1,11 @@
1
- # @axeldev09/zenbot-scraper
1
+ # @soyaxell09/zenbot-scraper
2
2
 
3
3
  Módulo npm de scrapers y herramientas para bots de WhatsApp. Incluye descargadores, buscadores y utilidades.
4
4
 
5
5
  ## Instalación
6
6
 
7
7
  ```bash
8
- npm install @axeldev09/zenbot-scraper
8
+ npm install @soyaxell09/zenbot-scraper
9
9
  ```
10
10
 
11
11
  ---
@@ -26,7 +26,7 @@ src/
26
26
  ### YouTube
27
27
 
28
28
  ```js
29
- import { ytSearch, ytDownload, ytInfo } from '@axeldev09/zenbot-scraper'
29
+ import { ytSearch, ytDownload, ytInfo } from '@soyaxell09/zenbot-scraper'
30
30
 
31
31
  // Buscar videos
32
32
  const results = await ytSearch('bad bunny', 5)
@@ -41,7 +41,26 @@ const audio = await ytDownload('nicki nicole wapo traketero', 'mp3')
41
41
  ### YouTube v2 (via ytdown.to — más calidades)
42
42
 
43
43
  ```js
44
- import { ytDownloadV2, ytInfoV2, getFileSizeV2 } from '@axeldev09/zenbot-scraper'
44
+ import { ytDownloadV2, ytInfoV2, getFileSizeV2 } from '@soyaxell09/zenbot-scraper'
45
+
46
+ // Ver calidades disponibles
47
+ const info = await ytInfoV2('https://youtu.be/dQw4w9WgXcQ')
48
+ // → { title, uploader, views, thumb, qualities: [{ id, type, quality, size, sizeB, duration }] }
49
+
50
+ // Descargar con calidad específica
51
+ const video = await ytDownloadV2('https://youtu.be/dQw4w9WgXcQ', 'video', '1080p')
52
+ const audio = await ytDownloadV2('https://youtu.be/dQw4w9WgXcQ', 'mp3', '128k')
53
+ // → { title, uploader, views, thumb, type, quality, size, sizeB, duration, url }
54
+
55
+ // Obtener tamaño de un archivo por URL
56
+ const size = await getFileSizeV2('https://example.com/file.mp4')
57
+ // → '14.5 MB'
58
+ ```
59
+
60
+ ### YouTube v2 (via ytdown.to — más calidades)
61
+
62
+ ```js
63
+ import { ytDownloadV2, ytInfoV2, getFileSizeV2 } from '@soyaxell09/zenbot-scraper'
45
64
 
46
65
  // Ver calidades disponibles
47
66
  const info = await ytInfoV2('https://youtu.be/dQw4w9WgXcQ')
@@ -60,7 +79,7 @@ const size = await getFileSizeV2('https://example.com/file.mp4')
60
79
  ### TikTok
61
80
 
62
81
  ```js
63
- import { tiktokDownload, tiktokInfo } from '@axeldev09/zenbot-scraper'
82
+ import { tiktokDownload, tiktokInfo } from '@soyaxell09/zenbot-scraper'
64
83
 
65
84
  const result = await tiktokDownload('https://www.tiktok.com/@user/video/123')
66
85
  // → { nowatermark, watermark, audio, music: { title, author, url }, stats: { plays, likes, comments, shares } }
@@ -69,7 +88,7 @@ const result = await tiktokDownload('https://www.tiktok.com/@user/video/123')
69
88
  ### Facebook
70
89
 
71
90
  ```js
72
- import { fbDownload } from '@axeldev09/zenbot-scraper'
91
+ import { fbDownload } from '@soyaxell09/zenbot-scraper'
73
92
 
74
93
  const result = await fbDownload('https://www.facebook.com/watch?v=123')
75
94
  // → { hd, sd, thumb, title }
@@ -78,7 +97,7 @@ const result = await fbDownload('https://www.facebook.com/watch?v=123')
78
97
  ### Twitter / X
79
98
 
80
99
  ```js
81
- import { tweetInfo, tweetDownload } from '@axeldev09/zenbot-scraper'
100
+ import { tweetInfo, tweetDownload } from '@soyaxell09/zenbot-scraper'
82
101
 
83
102
  // Info completa del tweet
84
103
  const info = await tweetInfo('https://x.com/user/status/123')
@@ -89,10 +108,24 @@ const media = await tweetDownload('https://x.com/user/status/123')
89
108
  // → { id, text, author, videos: [{ type, url, thumbnail, variants }], photos: [{ type, url, width, height }] }
90
109
  ```
91
110
 
111
+ ### Twitter / X
112
+
113
+ ```js
114
+ import { tweetInfo, tweetDownload } from '@soyaxell09/zenbot-scraper'
115
+
116
+ // Info completa del tweet
117
+ const info = await tweetInfo('https://x.com/user/status/123')
118
+ // → { id, text, createdAt, likes, replies, author: { name, username, avatar }, hashtags, medias }
119
+
120
+ // Solo media descargable
121
+ const media = await tweetDownload('https://x.com/user/status/123')
122
+ // → { id, text, author, videos: [{ type, url, thumbnail }], photos: [{ type, url }] }
123
+ ```
124
+
92
125
  ### MediaFire
93
126
 
94
127
  ```js
95
- import { mediafireInfo } from '@axeldev09/zenbot-scraper'
128
+ import { mediafireInfo } from '@soyaxell09/zenbot-scraper'
96
129
 
97
130
  const result = await mediafireInfo('https://www.mediafire.com/file/abc123/archivo.apk/file')
98
131
  // → { key, name, size, download, url }
@@ -101,7 +134,7 @@ const result = await mediafireInfo('https://www.mediafire.com/file/abc123/archiv
101
134
  ### GitHub
102
135
 
103
136
  ```js
104
- import { githubInfo, githubRelease, githubContents, githubSearch } from '@axeldev09/zenbot-scraper'
137
+ import { githubInfo, githubRelease, githubContents, githubSearch } from '@soyaxell09/zenbot-scraper'
105
138
 
106
139
  // Info del repositorio
107
140
  const info = await githubInfo('facebook/react')
@@ -123,7 +156,21 @@ const repos = await githubSearch('whatsapp bot', 'repositories', 5)
123
156
  ### APK (APKPure)
124
157
 
125
158
  ```js
126
- import { apkSearch, apkInfo } from '@axeldev09/zenbot-scraper'
159
+ import { apkSearch, apkInfo } from '@soyaxell09/zenbot-scraper'
160
+
161
+ // Buscar por nombre
162
+ const results = await apkSearch('whatsapp', 3)
163
+ // → [{ name, developer, pkg, date, icon, appUrl, dlUrl }]
164
+
165
+ // Info por package name
166
+ const info = await apkInfo('com.whatsapp')
167
+ // → { name, developer, pkg, date, icon, download, dlLinks, url }
168
+ ```
169
+
170
+ ### APK (APKPure)
171
+
172
+ ```js
173
+ import { apkSearch, apkInfo } from '@soyaxell09/zenbot-scraper'
127
174
 
128
175
  // Buscar por nombre
129
176
  const results = await apkSearch('whatsapp', 3)
@@ -134,6 +181,27 @@ const info = await apkInfo('com.whatsapp')
134
181
  // → { name, developer, pkg, date, icon, download, dlLinks, url }
135
182
  ```
136
183
 
184
+
185
+ ### Google Drive
186
+
187
+ ```js
188
+ import { gdriveInfo, gdriveDownload } from '@soyaxell09/zenbot-scraper'
189
+
190
+ // Info del archivo
191
+ const info = await gdriveInfo('https://drive.google.com/file/d/1ABC.../view')
192
+ // → { fileId, name, download, url }
193
+
194
+ // Descargar archivo (devuelve buffer)
195
+ const file = await gdriveDownload('https://drive.google.com/file/d/1ABC.../view')
196
+ // → { fileId, buffer, contentType, size, url }
197
+
198
+ // También acepta ID directo
199
+ const file2 = await gdriveDownload('1mkfqv5lwuNGpKatPRzPP4r01N6ZFxwBY')
200
+ ```
201
+
202
+ > Soporta archivos públicos. Para archivos grandes maneja automáticamente la confirmación del virus scan de Google.
203
+
204
+
137
205
  ---
138
206
 
139
207
  ## 🔍 Search
@@ -141,7 +209,7 @@ const info = await apkInfo('com.whatsapp')
141
209
  ### Google (DuckDuckGo)
142
210
 
143
211
  ```js
144
- import { googleSearch } from '@axeldev09/zenbot-scraper'
212
+ import { googleSearch } from '@soyaxell09/zenbot-scraper'
145
213
 
146
214
  const results = await googleSearch('node.js tutorial', 5)
147
215
  // → [{ title, url, snippet }]
@@ -150,7 +218,7 @@ const results = await googleSearch('node.js tutorial', 5)
150
218
  ### Spotify / Deezer
151
219
 
152
220
  ```js
153
- import { spotify } from '@axeldev09/zenbot-scraper'
221
+ import { spotify } from '@soyaxell09/zenbot-scraper'
154
222
 
155
223
  // Buscar tracks
156
224
  const tracks = await spotify('bad bunny', 'tracks', 5)
@@ -163,7 +231,7 @@ const albums = await spotify('bad bunny', 'albums', 3)
163
231
  ### Tenor (GIFs)
164
232
 
165
233
  ```js
166
- import { giphy } from '@axeldev09/zenbot-scraper'
234
+ import { giphy } from '@soyaxell09/zenbot-scraper'
167
235
 
168
236
  const gifs = await giphy('funny cat', 5)
169
237
  // → [{ id, title, url, gif, preview, mp4, width, height }]
@@ -172,7 +240,7 @@ const gifs = await giphy('funny cat', 5)
172
240
  ### Pinterest
173
241
 
174
242
  ```js
175
- import { pinsearch, pinimg, pinvid } from '@axeldev09/zenbot-scraper'
243
+ import { pinsearch, pinimg, pinvid } from '@soyaxell09/zenbot-scraper'
176
244
 
177
245
  // Buscar imágenes por texto
178
246
  const imgs = await pinsearch('anime wallpaper', 5)
@@ -193,10 +261,29 @@ const pinVid = await pinvid('https://www.pinterest.com/pin/123/')
193
261
 
194
262
  ## 🛠️ Tools
195
263
 
264
+ ### YouTube v2 (via ytdown.to — más calidades)
265
+
266
+ ```js
267
+ import { ytDownloadV2, ytInfoV2, getFileSizeV2 } from '@soyaxell09/zenbot-scraper'
268
+
269
+ // Ver calidades disponibles
270
+ const info = await ytInfoV2('https://youtu.be/dQw4w9WgXcQ')
271
+ // → { title, uploader, views, thumb, qualities: [{ id, type, quality, size, sizeB, duration }] }
272
+
273
+ // Descargar con calidad específica
274
+ const video = await ytDownloadV2('https://youtu.be/dQw4w9WgXcQ', 'video', '1080p')
275
+ const audio = await ytDownloadV2('https://youtu.be/dQw4w9WgXcQ', 'mp3', '128k')
276
+ // → { title, uploader, views, thumb, type, quality, size, sizeB, duration, url }
277
+
278
+ // Obtener tamaño de un archivo por URL
279
+ const size = await getFileSizeV2('https://example.com/file.mp4')
280
+ // → '14.5 MB'
281
+ ```
282
+
196
283
  ### TikTok Stalk
197
284
 
198
285
  ```js
199
- import { tiktokStalk } from '@axeldev09/zenbot-scraper'
286
+ import { tiktokStalk } from '@soyaxell09/zenbot-scraper'
200
287
 
201
288
  const profile = await tiktokStalk('charlidamelio')
202
289
  // → { id, username, nickname, bio, avatar, verified, private, bioLink, stats: { followers, following, likes, videos, followersStr, ... }, url }
@@ -205,7 +292,7 @@ const profile = await tiktokStalk('charlidamelio')
205
292
  ### Letras de canciones
206
293
 
207
294
  ```js
208
- import { lyricsSearch, lyricsGet } from '@axeldev09/zenbot-scraper'
295
+ import { lyricsSearch, lyricsGet } from '@soyaxell09/zenbot-scraper'
209
296
 
210
297
  // Buscar por texto libre
211
298
  const results = await lyricsSearch('bad bunny tití me preguntó', 3)
@@ -220,7 +307,7 @@ const song = await lyricsGet('Bad Bunny', 'Tití Me Preguntó')
220
307
  ### Traductor
221
308
 
222
309
  ```js
223
- import { translate, getLangs } from '@axeldev09/zenbot-scraper'
310
+ import { translate, getLangs } from '@soyaxell09/zenbot-scraper'
224
311
 
225
312
  // Traducir (auto-detecta idioma origen)
226
313
  const result = await translate('Hello, how are you?', 'es')
@@ -239,7 +326,7 @@ const langs = getLangs()
239
326
  ### Clima
240
327
 
241
328
  ```js
242
- import { weather } from '@axeldev09/zenbot-scraper'
329
+ import { weather } from '@soyaxell09/zenbot-scraper'
243
330
 
244
331
  const w = await weather('Buenos Aires')
245
332
  // → { location, temp, feelsLike, humidity, wind, windDir, visibility, pressure, uvIndex, description, forecast: [{ date, maxTemp, minTemp, desc, sunrise, sunset }] }
@@ -248,7 +335,7 @@ const w = await weather('Buenos Aires')
248
335
  ### QR
249
336
 
250
337
  ```js
251
- import { qrGenerate, qrRead } from '@axeldev09/zenbot-scraper'
338
+ import { qrGenerate, qrRead } from '@soyaxell09/zenbot-scraper'
252
339
 
253
340
  // Generar QR
254
341
  const qr = await qrGenerate('https://github.com/axeldev09', 300)
@@ -262,7 +349,7 @@ const result = await qrRead('https://example.com/qr.png')
262
349
  ### Acortador de URLs
263
350
 
264
351
  ```js
265
- import { shortenUrl, expandUrl } from '@axeldev09/zenbot-scraper'
352
+ import { shortenUrl, expandUrl } from '@soyaxell09/zenbot-scraper'
266
353
 
267
354
  // Acortar
268
355
  const short = await shortenUrl('https://github.com/axeldev09/zenbot-scraper')
@@ -276,7 +363,7 @@ const expanded = await expandUrl('https://is.gd/xxxxx')
276
363
  ### Noticias
277
364
 
278
365
  ```js
279
- import { news, newsCategories } from '@axeldev09/zenbot-scraper'
366
+ import { news, newsCategories } from '@soyaxell09/zenbot-scraper'
280
367
 
281
368
  // Obtener noticias
282
369
  const n = await news('es', 5)
@@ -290,10 +377,27 @@ const cats = newsCategories()
290
377
  ---
291
378
 
292
379
 
380
+ ### Stickers (GetStickerPack)
381
+
382
+ ```js
383
+ import { stickerSearch } from '@soyaxell09/zenbot-scraper'
384
+
385
+ // Buscar packs por texto — devuelve un pack aleatorio con sus stickers
386
+ const result = await stickerSearch('anime', 10)
387
+ // → {
388
+ // status: true,
389
+ // nombre: 'My Hero Academia',
390
+ // creador: '@false_eye',
391
+ // total: 39,
392
+ // fotos: ['https://s3.getstickerpack.com/...webp', ...],
393
+ // url: 'https://getstickerpack.com/stickers/...'
394
+ // }
395
+ ```
396
+
293
397
  ### Upload (Catbox.moe)
294
398
 
295
399
  ```js
296
- import { upload } from '@axeldev09/zenbot-scraper'
400
+ import { upload } from '@soyaxell09/zenbot-scraper'
297
401
 
298
402
  // Por ruta de archivo local
299
403
  const r1 = await upload('/sdcard/foto.jpg')
@@ -314,16 +418,16 @@ const r3 = await upload(buffer, 'video.mp4')
314
418
 
315
419
  ```js
316
420
  // Todo desde el índice principal
317
- import { ytDownload, tiktokDownload, translate, weather } from '@axeldev09/zenbot-scraper'
421
+ import { ytDownload, tiktokDownload, translate, weather } from '@soyaxell09/zenbot-scraper'
318
422
 
319
423
  // Solo scrapers
320
- import { ytDownload, fbDownload } from '@axeldev09/zenbot-scraper/scrapers'
424
+ import { ytDownload, fbDownload } from '@soyaxell09/zenbot-scraper/scrapers'
321
425
 
322
426
  // Solo search
323
- import { googleSearch, spotify } from '@axeldev09/zenbot-scraper/search'
427
+ import { googleSearch, spotify } from '@soyaxell09/zenbot-scraper/search'
324
428
 
325
429
  // Solo tools
326
- import { translate, weather, news } from '@axeldev09/zenbot-scraper/tools'
430
+ import { translate, weather, news } from '@soyaxell09/zenbot-scraper/tools'
327
431
  ```
328
432
 
329
433
  ---
@@ -339,6 +443,20 @@ import { translate, weather, news } from '@axeldev09/zenbot-scraper/tools'
339
443
 
340
444
  **AxelDev09** — [GitHub](https://github.com/axeldev09)
341
445
 
446
+ ---
447
+
448
+ ## ⭐ Apoyá el proyecto
449
+
450
+ Si este módulo te fue útil, dejá una ⭐ en el repositorio. Le pusimos mucho esfuerzo y tiempo para que funcione bien.
451
+
452
+ **Dejá los créditos** si usás este módulo en tu bot — es lo único que se pide 🙏
453
+
454
+ 📸 Seguime en Instagram: [@axeldev09](https://instagram.com/axeldev09)
455
+
456
+ 📢 Canal oficial de ZenBot en WhatsApp: [Unirse al canal](https://whatsapp.com/channel/0029Vb6OR9O2v1IvoXO5oT2c)
457
+
458
+ ---
459
+
342
460
  ## 📄 Licencia
343
461
 
344
462
  MIT
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soyaxell09/zenbot-scraper",
3
- "version": "1.0.5",
4
- "description": "Scrapers de descarga y búsqueda para bots de WhatsApp — YouTube, TikTok, Facebook, Twitter, Pinterest, MediaFire, GitHub, APK y más.",
3
+ "version": "1.0.8",
4
+ "description": "Scrapers de descarga y búsqueda para bots de WhatsApp — YouTube, TikTok, Facebook, Twitter, Pinterest, MediaFire, GitHub, APK, Google Drive y más.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "exports": {
@@ -34,7 +34,10 @@
34
34
  "translate",
35
35
  "qr",
36
36
  "news",
37
- "upload"
37
+ "upload",
38
+ "stickers",
39
+ "gdrive",
40
+ "google-drive"
38
41
  ],
39
42
  "author": "AxelDev09",
40
43
  "license": "MIT",
package/src/index.js CHANGED
@@ -13,11 +13,12 @@ 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
+ export { gdriveInfo, gdriveDownload } from './scrapers/gdrive.js'
17
17
  export { googleSearch } from './search/google.js'
18
18
  export { spotify } from './search/spotify.js'
19
19
  export { giphy } from './search/giphy.js'
20
20
  export { pinsearch, pinimg, pinvid } from './search/pinterest.js'
21
+ export { stickerSearch } from './search/stickersearch.js'
21
22
  export { tiktokStalk } from './tools/tiktokstalk.js'
22
23
  export { lyricsSearch, lyricsGet } from './tools/lyrics.js'
23
24
  export { translate, getLangs } from './tools/translator.js'
@@ -0,0 +1,77 @@
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
+
10
+ const HEADERS = {
11
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36',
12
+ }
13
+
14
+ function parseFileId(input) {
15
+ const m1 = input.match(/\/d\/([a-zA-Z0-9_-]{20,})/)
16
+ if (m1) return m1[1]
17
+ const m2 = input.match(/[?&]id=([a-zA-Z0-9_-]{20,})/)
18
+ if (m2) return m2[1]
19
+ if (/^[a-zA-Z0-9_-]{20,}$/.test(input)) return input
20
+ return null
21
+ }
22
+
23
+ export async function gdriveInfo(input) {
24
+ const fileId = parseFileId(input)
25
+ if (!fileId) throw new Error('URL o ID de Google Drive inválido')
26
+
27
+ const res = await axios.get(`https://drive.google.com/file/d/${fileId}/view`, { headers: HEADERS, timeout: 15000 })
28
+ const html = res.data
29
+ const title = html.match(/<title>([^<]+)<\/title>/)?.[1]?.replace(' - Google Drive', '').trim() || ''
30
+
31
+ return {
32
+ fileId,
33
+ name: title,
34
+ download: `https://drive.google.com/uc?export=download&id=${fileId}`,
35
+ url: `https://drive.google.com/file/d/${fileId}/view`,
36
+ }
37
+ }
38
+
39
+ export async function gdriveDownload(input) {
40
+ const fileId = parseFileId(input)
41
+ if (!fileId) throw new Error('URL o ID de Google Drive inválido')
42
+
43
+ const res = await axios.get(
44
+ `https://drive.google.com/uc?export=download&id=${fileId}`,
45
+ { headers: HEADERS, maxRedirects: 10, timeout: 30000, responseType: 'arraybuffer' }
46
+ )
47
+
48
+ const contentType = res.headers['content-type'] || 'application/octet-stream'
49
+ const finalUrl = res.request?.res?.responseUrl || `https://drive.usercontent.google.com/download?id=${fileId}&export=download`
50
+
51
+ if (contentType.includes('text/html')) {
52
+ const html = Buffer.from(res.data).toString()
53
+ const confirm = html.match(/confirm=([^&"]+)/)
54
+ if (confirm) {
55
+ const res2 = await axios.get(
56
+ `https://drive.google.com/uc?export=download&id=${fileId}&confirm=${confirm[1]}`,
57
+ { headers: HEADERS, maxRedirects: 10, timeout: 30000, responseType: 'arraybuffer' }
58
+ )
59
+ return {
60
+ fileId,
61
+ buffer: Buffer.from(res2.data),
62
+ contentType: res2.headers['content-type'] || contentType,
63
+ size: parseInt(res2.headers['content-length'] || '0'),
64
+ url: finalUrl,
65
+ }
66
+ }
67
+ throw new Error('Google Drive requiere autenticación o el archivo no es público')
68
+ }
69
+
70
+ return {
71
+ fileId,
72
+ buffer: Buffer.from(res.data),
73
+ contentType,
74
+ size: parseInt(res.headers['content-length'] || '0'),
75
+ url: finalUrl,
76
+ }
77
+ }
@@ -1,9 +1,9 @@
1
- export { ytInfo, ytDownload, ytSearch } from './youtube.js'
2
- export { ytInfoV2, ytDownloadV2, getFileSizeV2 } from './youtubev2.js'
3
- export { tiktokInfo, tiktokDownload } from './tiktok.js'
4
- export { fbDownload } from './facebook.js'
5
- export { tweetInfo, tweetDownload } from './twitter.js'
6
- export { mediafireInfo } from './mediafire.js'
1
+ export { ytInfo, ytDownload, ytSearch } from './youtube.js'
2
+ export { ytInfoV2, ytDownloadV2, getFileSizeV2 } from './youtubev2.js'
3
+ export { tiktokInfo, tiktokDownload } from './tiktok.js'
4
+ export { fbDownload } from './facebook.js'
5
+ export { tweetInfo, tweetDownload } from './twitter.js'
6
+ export { mediafireInfo } from './mediafire.js'
7
7
  export { githubInfo, githubRelease, githubContents, githubSearch } from './github.js'
8
- export { apkSearch, apkInfo } from './apk.js'
9
- export { stickerSearch, stickerPack } from './stickers.js'
8
+ export { apkSearch, apkInfo } from './apk.js'
9
+ export { gdriveInfo, gdriveDownload } from './gdrive.js'
@@ -10,3 +10,4 @@ export { googleSearch } from './google.js'
10
10
  export { spotify } from './spotify.js'
11
11
  export { giphy } from './giphy.js'
12
12
  export { pinsearch, pinimg, pinvid } from './pinterest.js'
13
+ export { stickerSearch } from './stickersearch.js'
@@ -0,0 +1,49 @@
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
+ export async function stickerSearch(text, limit = 10) {
12
+ try {
13
+ const response = await axios.get(
14
+ `https://getstickerpack.com/stickers?query=${encodeURIComponent(text)}`
15
+ )
16
+ const $ = cheerio.load(response.data)
17
+ const packs = $('.sticker-pack-block')
18
+
19
+ if (packs.length === 0)
20
+ return { status: false, text: 'ningún resultado encontrado' }
21
+
22
+ const randomIndex = Math.floor(Math.random() * packs.length)
23
+ const selectedPack = $(packs[randomIndex])
24
+ const title = selectedPack.find('.title').text().trim()
25
+ const creator = selectedPack.find('.username').text().trim()
26
+ const packLink = selectedPack.closest('a').attr('href')
27
+
28
+ const packResponse = await axios.get(packLink)
29
+ const packHtml = cheerio.load(packResponse.data)
30
+ const images = packHtml('.sticker-pack-cols img')
31
+ const totalImages = images.length
32
+
33
+ const imageArray = []
34
+ images.each((i, img) => {
35
+ if (i < limit) imageArray.push(packHtml(img).attr('src'))
36
+ })
37
+
38
+ return {
39
+ status: true,
40
+ nombre: title,
41
+ creador: creator,
42
+ total: totalImages,
43
+ fotos: imageArray,
44
+ url: packLink,
45
+ }
46
+ } catch (error) {
47
+ return { status: false, text: 'Error al acceder al sitio' }
48
+ }
49
+ }
@@ -1,101 +0,0 @@
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
- }