@soyaxell09/zenbot-scraper 1.0.7 → 1.0.9

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
@@ -182,6 +182,26 @@ const info = await apkInfo('com.whatsapp')
182
182
  ```
183
183
 
184
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
+
185
205
  ---
186
206
 
187
207
  ## 🔍 Search
@@ -239,6 +259,45 @@ const pinVid = await pinvid('https://www.pinterest.com/pin/123/')
239
259
 
240
260
  ---
241
261
 
262
+ ### Imágenes de Anime (Wallhaven + Konachan)
263
+
264
+ ```js
265
+ import { animeImage } from '@soyaxell09/zenbot-scraper'
266
+
267
+ const results = await animeImage('naruto', 5)
268
+ // → [{ image, url, source }]
269
+ ```
270
+
271
+ > Devuelve imágenes SFW de Wallhaven y Konachan mezcladas aleatoriamente.
272
+
273
+ ### Wallpapers (BestHDWallpaper)
274
+
275
+ ```js
276
+ import { wallpaperSearch } from '@soyaxell09/zenbot-scraper'
277
+
278
+ const results = await wallpaperSearch('nature', 10)
279
+ // → [{ title, image, url }]
280
+ ```
281
+
282
+
283
+
284
+ ### Stickers (GetStickerPack)
285
+
286
+ ```js
287
+ import { stickerSearch } from '@soyaxell09/zenbot-scraper'
288
+
289
+ // Buscar packs por texto — devuelve un pack aleatorio con sus stickers
290
+ const result = await stickerSearch('anime', 10)
291
+ // → {
292
+ // status: true,
293
+ // nombre: 'My Hero Academia',
294
+ // creador: '@false_eye',
295
+ // total: 39,
296
+ // fotos: ['https://s3.getstickerpack.com/...webp', ...],
297
+ // url: 'https://getstickerpack.com/stickers/...'
298
+ // }
299
+ ```
300
+
242
301
  ## 🛠️ Tools
243
302
 
244
303
  ### YouTube v2 (via ytdown.to — más calidades)
@@ -357,23 +416,6 @@ const cats = newsCategories()
357
416
  ---
358
417
 
359
418
 
360
- ### Stickers (StickersCloud)
361
-
362
- ```js
363
- import { stickerSearch, stickerPack } from '@soyaxell09/zenbot-scraper'
364
-
365
- // Buscar packs por texto
366
- const packs = await stickerSearch('anime', 5)
367
- // → [{ packId, name, url, preview }]
368
-
369
- // Obtener stickers de un pack
370
- const pack = await stickerPack('mochi-mochi-peach-cat-christmas', 10)
371
- // → { packId, name, url, total, stickers: ['https://img-xx.stickers.cloud/...webp'] }
372
-
373
- // También acepta URL completa
374
- const pack2 = await stickerPack('https://stickerscloud.com/en/pack/anime-pack')
375
- ```
376
-
377
419
  ### Upload (Catbox.moe)
378
420
 
379
421
  ```js
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soyaxell09/zenbot-scraper",
3
- "version": "1.0.7",
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.9",
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": {
@@ -35,7 +35,9 @@
35
35
  "qr",
36
36
  "news",
37
37
  "upload",
38
- "stickers"
38
+ "stickers",
39
+ "gdrive",
40
+ "google-drive"
39
41
  ],
40
42
  "author": "AxelDev09",
41
43
  "license": "MIT",
package/src/index.js CHANGED
@@ -13,11 +13,14 @@ 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 { gdriveInfo, gdriveDownload } from './scrapers/gdrive.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'
19
20
  export { pinsearch, pinimg, pinvid } from './search/pinterest.js'
20
21
  export { stickerSearch } from './search/stickersearch.js'
22
+ export { animeImage } from './search/anime.js'
23
+ export { wallpaperSearch } from './search/wallpaper.js'
21
24
  export { tiktokStalk } from './tools/tiktokstalk.js'
22
25
  export { lyricsSearch, lyricsGet } from './tools/lyrics.js'
23
26
  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,8 +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'
8
+ export { apkSearch, apkInfo } from './apk.js'
9
+ export { gdriveInfo, gdriveDownload } from './gdrive.js'
@@ -0,0 +1,73 @@
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
+
15
+ async function fromWallhaven(query, limit) {
16
+ const res = await axios.get(
17
+ `https://wallhaven.cc/search?q=${encodeURIComponent(query)}&categories=010&purity=100&sorting=relevance`,
18
+ { headers: HEADERS, timeout: 15000 }
19
+ )
20
+ const $ = cheerio.load(res.data)
21
+ const results = []
22
+
23
+ $('figure.thumb').each((_, el) => {
24
+ if (results.length >= limit) return false
25
+ const thumb = $(el).find('img.lazyload').attr('data-src') || $(el).find('img').attr('src') || ''
26
+ const id = $(el).attr('data-wallpaper-id') || ''
27
+ const url = id ? `https://wallhaven.cc/w/${id}` : ''
28
+ if (thumb) results.push({ image: thumb, url, source: 'wallhaven' })
29
+ })
30
+
31
+ return results
32
+ }
33
+
34
+ async function fromKonachan(query, limit) {
35
+ const res = await axios.get(
36
+ `https://konachan.com/post?tags=${encodeURIComponent(query + ' rating:s')}&limit=${limit}`,
37
+ { headers: HEADERS, timeout: 15000 }
38
+ )
39
+ const $ = cheerio.load(res.data)
40
+ const results = []
41
+
42
+ $('img.preview').each((_, el) => {
43
+ if (results.length >= limit) return false
44
+ const thumb = $(el).attr('src') || ''
45
+ const full = $(el).closest('a').attr('href') || ''
46
+ if (thumb) results.push({ image: thumb, url: full ? `https://konachan.com${full}` : '', source: 'konachan' })
47
+ })
48
+
49
+ return results
50
+ }
51
+
52
+ export async function animeImage(query, limit = 10) {
53
+ if (!query?.trim()) throw new Error('Query vacío')
54
+
55
+ const errors = []
56
+ let results = []
57
+
58
+ try {
59
+ const wh = await fromWallhaven(query, limit)
60
+ if (wh.length) results = results.concat(wh)
61
+ } catch (e) { errors.push('wallhaven: ' + e.message) }
62
+
63
+ try {
64
+ const kc = await fromKonachan(query, limit)
65
+ if (kc.length) results = results.concat(kc)
66
+ } catch (e) { errors.push('konachan: ' + e.message) }
67
+
68
+ if (!results.length) throw new Error('Sin resultados. Errores: ' + errors.join(' | '))
69
+
70
+ results = results.sort(() => Math.random() - 0.5).slice(0, limit)
71
+
72
+ return results
73
+ }
@@ -11,3 +11,5 @@ export { spotify } from './spotify.js'
11
11
  export { giphy } from './giphy.js'
12
12
  export { pinsearch, pinimg, pinvid } from './pinterest.js'
13
13
  export { stickerSearch } from './stickersearch.js'
14
+ export { animeImage } from './anime.js'
15
+ export { wallpaperSearch } from './wallpaper.js'
@@ -0,0 +1,45 @@
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
+
15
+ export async function wallpaperSearch(query, limit = 10) {
16
+ if (!query?.trim()) throw new Error('Query vacío')
17
+
18
+ const res = await axios.get(
19
+ 'https://www.besthdwallpaper.com/search?q=' + encodeURIComponent(query),
20
+ { headers: HEADERS, timeout: 15000 }
21
+ )
22
+
23
+ const $ = cheerio.load(res.data)
24
+ const results = []
25
+
26
+ $('img').each((_, el) => {
27
+ if (results.length >= limit) return false
28
+ const src = $(el).attr('src') || ''
29
+ if (!src.includes('bhdw.net') || src.includes('icon') || src.includes('svg')) return
30
+
31
+ const parent = $(el).closest('a')
32
+ const href = parent.attr('href') || ''
33
+ const alt = $(el).attr('alt') || ''
34
+ const title = alt.replace(/\s*download\s*$/i, '').trim()
35
+
36
+ results.push({
37
+ title,
38
+ image: src,
39
+ url: href ? 'https://www.besthdwallpaper.com' + href : '',
40
+ })
41
+ })
42
+
43
+ if (!results.length) throw new Error('Sin resultados para: ' + query)
44
+ return results
45
+ }
package/test.js CHANGED
@@ -1,4 +1,4 @@
1
- import { stickerSearch } from './src/index.js'
1
+ import { wallpaperSearch } from './src/search/wallpaper.js'
2
2
 
3
- const result = await stickerSearch('anime')
4
- console.log(result)
3
+ const results = await wallpaperSearch('nature', 5)
4
+ console.log(results)
package/test.js.bak DELETED
@@ -1,5 +0,0 @@
1
- import { stickerSearch } from './src/index.js'
2
-
3
- const result = await stickerSearch('anime')
4
- console.log(result.name, result.creator, result.total)
5
- console.log(result.stickers[0])