@soyaxell09/zenbot-scraper 1.1.4 → 1.1.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/README.md +3 -1
- package/package.json +1 -1
- package/src/scrapers/index.js +12 -0
- package/test.js +0 -130
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soyaxell09/zenbot-scraper",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Scrapers de descarga y búsqueda para bots de WhatsApp — YouTube, TikTok, Instagram, Facebook, Twitter, Pinterest, MediaFire, GitHub, APK, Google Drive, XNXX, PornHub, XVideos, XHamster, Rule34, Screenshot y más.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { ytInfo, ytDownload, ytSearch, getFileSize } from './youtube.js'
|
|
2
|
+
export { youtubeDownload } 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
|
+
export { githubInfo, githubRelease, githubContents, githubSearch } from './github.js'
|
|
8
|
+
export { apkSearch, apkInfo } from './apk.js'
|
|
9
|
+
export { gdriveInfo, gdriveDownload } from './gdrive.js'
|
|
10
|
+
export { igDownload, igReelDownload, igStalk, igStories } from './instagram.js'
|
|
11
|
+
export { threadsDownload } from './threads.js'
|
|
12
|
+
export { spotidownTrack } from './spotidown.js'
|
package/test.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* TEST — apk.js
|
|
3
|
-
* Corre con: node test.js
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import axios from 'axios'
|
|
7
|
-
import * as cheerio from 'cheerio'
|
|
8
|
-
import { createWriteStream, statSync } from 'fs'
|
|
9
|
-
import { pipeline } from 'stream/promises'
|
|
10
|
-
|
|
11
|
-
const UA = 'Mozilla/5.0 (Linux; Android 11; Redmi Note 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36'
|
|
12
|
-
const BASE = 'https://apkpure.net'
|
|
13
|
-
const DL_BASE = 'https://d.apkpure.net'
|
|
14
|
-
const HEADERS = { 'User-Agent': UA, 'Referer': BASE }
|
|
15
|
-
|
|
16
|
-
const QUERY = 'Google Fotos'
|
|
17
|
-
const PKG = 'org.telegram.messenger'
|
|
18
|
-
const SAVE_PATH = '/sdcard/test-apk.apk'
|
|
19
|
-
|
|
20
|
-
async function test(name, fn) {
|
|
21
|
-
console.log(`\n── ${name} ──`)
|
|
22
|
-
try {
|
|
23
|
-
const r = await fn()
|
|
24
|
-
console.log(`✅ OK`)
|
|
25
|
-
console.log(` ${JSON.stringify(r).slice(0, 300)}`)
|
|
26
|
-
return r
|
|
27
|
-
} catch (e) {
|
|
28
|
-
console.log(`❌ ERROR: ${e.message}`)
|
|
29
|
-
return null
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
console.log('='.repeat(50))
|
|
34
|
-
console.log(' TEST — apk.js')
|
|
35
|
-
console.log('='.repeat(50))
|
|
36
|
-
|
|
37
|
-
// ── 1. Búsqueda
|
|
38
|
-
await test(`apkSearch("${QUERY}")`, async () => {
|
|
39
|
-
const { data } = await axios.get(`${BASE}/search?q=${encodeURIComponent(QUERY)}`, {
|
|
40
|
-
headers: HEADERS, timeout: 15000
|
|
41
|
-
})
|
|
42
|
-
const $ = cheerio.load(data)
|
|
43
|
-
const items = []
|
|
44
|
-
$('.search-brand-container').each((_, el) => {
|
|
45
|
-
if (items.length >= 3) return false
|
|
46
|
-
const name = $(el).find('a.top').first().text().trim()
|
|
47
|
-
const pkg = $(el).find('[data-dt-pkg]').attr('data-dt-pkg') || ''
|
|
48
|
-
const appHref = $(el).find('a.top').first().attr('href') || ''
|
|
49
|
-
const appUrl = appHref.startsWith('http') ? appHref : `${BASE}${appHref}`
|
|
50
|
-
if (name && pkg) items.push({ name, pkg, appUrl, dlUrl: `${DL_BASE}/b/APK/${pkg}?version=latest` })
|
|
51
|
-
})
|
|
52
|
-
if (!items.length) throw new Error('Sin resultados — el selector puede haber cambiado')
|
|
53
|
-
return items
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
// ── 2. Info del APK
|
|
57
|
-
await test(`apkInfo("${PKG}")`, async () => {
|
|
58
|
-
const shortName = PKG.split('.').slice(-2).join('-').toLowerCase()
|
|
59
|
-
const { data } = await axios.get(`${BASE}/${shortName}/${PKG}/download`, {
|
|
60
|
-
headers: HEADERS, timeout: 15000, validateStatus: () => true
|
|
61
|
-
})
|
|
62
|
-
const $ = cheerio.load(data)
|
|
63
|
-
const version = $('[class*="version"]').first().text().trim()
|
|
64
|
-
const size = $('[class*="size"]').first().text().trim()
|
|
65
|
-
const title = $('title').text().trim()
|
|
66
|
-
const dlLinks = []
|
|
67
|
-
$(`a[href*="d.apkpure.net"]`).each((_, a) => {
|
|
68
|
-
const href = $(a).attr('href') || ''
|
|
69
|
-
if (href.includes(PKG)) dlLinks.push(href)
|
|
70
|
-
})
|
|
71
|
-
return { title, version, size, dlLinksCount: dlLinks.length, firstDlLink: dlLinks[0] || null }
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
// ── 3. HEAD — verificar URL de descarga
|
|
75
|
-
const DL_URL = `${DL_BASE}/b/APK/${PKG}?version=latest`
|
|
76
|
-
await test(`HEAD ${DL_URL.slice(0, 60)}...`, async () => {
|
|
77
|
-
const res = await axios.head(DL_URL, {
|
|
78
|
-
headers: { ...HEADERS, 'Accept': 'application/vnd.android.package-archive' },
|
|
79
|
-
timeout: 15000, maxRedirects: 5, validateStatus: () => true
|
|
80
|
-
})
|
|
81
|
-
return {
|
|
82
|
-
status: res.status,
|
|
83
|
-
contentType: res.headers['content-type'],
|
|
84
|
-
sizeMB: res.headers['content-length']
|
|
85
|
-
? (parseInt(res.headers['content-length']) / 1024 / 1024).toFixed(2) + ' MB'
|
|
86
|
-
: 'desconocido',
|
|
87
|
-
finalUrl: res.request?.res?.responseUrl?.slice(0, 80) || '',
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
// ── 4. Descarga real → /sdcard/test-apk.apk
|
|
92
|
-
await test(`Descarga real → ${SAVE_PATH}`, async () => {
|
|
93
|
-
const res = await axios.get(DL_URL, {
|
|
94
|
-
headers: { ...HEADERS, 'Accept': 'application/vnd.android.package-archive' },
|
|
95
|
-
responseType: 'stream',
|
|
96
|
-
timeout: 120000,
|
|
97
|
-
maxRedirects: 10,
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
const ct = res.headers['content-type'] || ''
|
|
101
|
-
const APK_TYPES = ['apk', 'octet-stream', 'zip', 'java-archive', 'android']
|
|
102
|
-
const esApk = APK_TYPES.some(t => ct.includes(t))
|
|
103
|
-
|
|
104
|
-
if (!esApk) {
|
|
105
|
-
// Leer primeros bytes como texto para ver si es HTML de error
|
|
106
|
-
const chunks = []
|
|
107
|
-
for await (const chunk of res.data) {
|
|
108
|
-
chunks.push(chunk)
|
|
109
|
-
if (Buffer.concat(chunks).length > 300) break
|
|
110
|
-
}
|
|
111
|
-
const preview = Buffer.concat(chunks).toString('utf8', 0, 200)
|
|
112
|
-
throw new Error(`Content-Type inesperado: ${ct}\nPreview: ${preview}`)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
await pipeline(res.data, createWriteStream(SAVE_PATH))
|
|
116
|
-
|
|
117
|
-
const { size } = statSync(SAVE_PATH)
|
|
118
|
-
if (size < 1000) throw new Error(`Archivo guardado pero muy pequeño (${size} bytes) — probablemente un error HTML`)
|
|
119
|
-
|
|
120
|
-
return {
|
|
121
|
-
contentType: ct,
|
|
122
|
-
sizeMB: (size / 1024 / 1024).toFixed(2) + ' MB',
|
|
123
|
-
guardado: SAVE_PATH,
|
|
124
|
-
valido: size > 100_000 ? '✅ APK válido' : '⚠️ Muy pequeño, verificar',
|
|
125
|
-
}
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
console.log('\n' + '='.repeat(50))
|
|
129
|
-
console.log(' Test terminado')
|
|
130
|
-
console.log('='.repeat(50))
|