@soyaxell09/zenbot-scraper 1.0.7 → 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 +33 -13
- package/package.json +5 -3
- package/src/index.js +1 -0
- package/src/scrapers/gdrive.js +77 -0
- package/src/scrapers/index.js +8 -7
- package/test.js +0 -4
- package/test.js.bak +0 -5
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
|
|
@@ -357,21 +377,21 @@ const cats = newsCategories()
|
|
|
357
377
|
---
|
|
358
378
|
|
|
359
379
|
|
|
360
|
-
### Stickers (
|
|
380
|
+
### Stickers (GetStickerPack)
|
|
361
381
|
|
|
362
382
|
```js
|
|
363
|
-
import { stickerSearch
|
|
364
|
-
|
|
365
|
-
// Buscar packs por texto
|
|
366
|
-
const
|
|
367
|
-
// →
|
|
368
|
-
|
|
369
|
-
//
|
|
370
|
-
|
|
371
|
-
//
|
|
372
|
-
|
|
373
|
-
//
|
|
374
|
-
|
|
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
|
+
// }
|
|
375
395
|
```
|
|
376
396
|
|
|
377
397
|
### Upload (Catbox.moe)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soyaxell09/zenbot-scraper",
|
|
3
|
-
"version": "1.0.
|
|
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": {
|
|
@@ -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,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 { 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'
|
|
@@ -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
|
+
}
|
package/src/scrapers/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { ytInfo, ytDownload, ytSearch }
|
|
2
|
-
export { ytInfoV2, ytDownloadV2, getFileSizeV2 }
|
|
3
|
-
export { tiktokInfo, tiktokDownload }
|
|
4
|
-
export { fbDownload }
|
|
5
|
-
export { tweetInfo, tweetDownload }
|
|
6
|
-
export { mediafireInfo }
|
|
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 }
|
|
8
|
+
export { apkSearch, apkInfo } from './apk.js'
|
|
9
|
+
export { gdriveInfo, gdriveDownload } from './gdrive.js'
|
package/test.js
DELETED