@soyaxell09/zenbot-scraper 1.1.5 → 1.1.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soyaxell09/zenbot-scraper",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
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",
package/src/index.js CHANGED
@@ -8,6 +8,8 @@
8
8
  export { ytInfo, ytDownload, ytSearch, getFileSize } from './scrapers/youtube.js'
9
9
  export { youtubeDownload } from './scrapers/youtubev2.js'
10
10
  export { tiktokInfo, tiktokDownload } from './scrapers/tiktok.js'
11
+ export { snaptikDownload } from './scrapers/snaptik.js'
12
+ export { deezerSearch, deezerTrack } from './scrapers/deezer.js'
11
13
  export { igDownload, igReelDownload, igStalk, igStories } from './scrapers/instagram.js'
12
14
  export { threadsDownload } from './scrapers/threads.js'
13
15
  export { spotidownTrack } from './scrapers/spotidown.js'
@@ -21,6 +23,7 @@ export { googleSearch } from './searc
21
23
  export { giphy, gifNext, giphyBuffer } from './search/giphy.js'
22
24
  export { pinsearch, pinimg, pinvid } from './search/pinterest.js'
23
25
  export { stickerSearch } from './search/stickersearch.js'
26
+ export { deezerFind, deezerSearchAlbum, deezerSearchArtist, deezerAlbumTracks, deezerArtistTopTracks } from './search/deezersearch.js'
24
27
  export { animeImage } from './search/anime.js'
25
28
  export { wallpaperSearch } from './search/wallpaper.js'
26
29
  export { tiktokStalk } from './tools/tiktokstalk.js'
@@ -0,0 +1,98 @@
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 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'
11
+ const BASE = 'https://flacdownloader.com'
12
+ const APIBASE = `${BASE}/flac`
13
+ const KEY = 'l@p*gute)77=g5clebcp4lz#=x%(*rwg+ku0_)bh=&%6wg!a'
14
+
15
+ const HEADERS = {
16
+ 'User-Agent': UA,
17
+ 'Referer': `${BASE}/`,
18
+ }
19
+
20
+ export async function deezerSearch(query, limit = 10) {
21
+ const { data } = await axios.get(`${APIBASE}/search`, {
22
+ params: { query },
23
+ headers: HEADERS,
24
+ timeout: 12000,
25
+ })
26
+
27
+ return (data.data || []).slice(0, limit).map(t => ({
28
+ id: t.id,
29
+ title: t.title,
30
+ duration: t.duration,
31
+ preview: t.preview,
32
+ explicit: t.explicit_lyrics,
33
+ link: t.link,
34
+ artist: {
35
+ id: t.artist?.id,
36
+ name: t.artist?.name,
37
+ picture: t.artist?.picture_medium,
38
+ },
39
+ album: {
40
+ id: t.album?.id,
41
+ title: t.album?.title,
42
+ cover: t.album?.cover_medium,
43
+ cover_xl: t.album?.cover_xl,
44
+ },
45
+ }))
46
+ }
47
+
48
+ export async function deezerDownload(trackId, format = 'flac') {
49
+ const { data: tokenData } = await axios.get(`${APIBASE}/download-token`, {
50
+ params: { t: trackId, f: format },
51
+ headers: { ...HEADERS, 'X-Download-Access': KEY },
52
+ timeout: 10000,
53
+ })
54
+
55
+ const { token, expires } = tokenData
56
+
57
+ const dlRes = await axios.get(`${APIBASE}/download`, {
58
+ params: {
59
+ t: trackId,
60
+ f: format,
61
+ token,
62
+ expires,
63
+ },
64
+ headers: HEADERS,
65
+ responseType: 'arraybuffer',
66
+ timeout: 60000,
67
+ })
68
+
69
+ const ext = format.toLowerCase().includes('flac') ? 'flac' : 'mp3'
70
+ const mimeType = ext === 'flac' ? 'audio/flac' : 'audio/mpeg'
71
+
72
+ return {
73
+ buffer: Buffer.from(dlRes.data),
74
+ ext,
75
+ mimeType,
76
+ size: parseInt(dlRes.headers['content-length'] || '0', 10),
77
+ }
78
+ }
79
+
80
+ export async function deezerTrack(query, format = 'mp3') {
81
+ const results = await deezerSearch(query, 1)
82
+ if (!results.length) throw new Error('No se encontraron resultados.')
83
+
84
+ const track = results[0]
85
+ const download = await deezerDownload(track.id, format)
86
+
87
+ return {
88
+ title: track.title,
89
+ artist: track.artist.name,
90
+ album: track.album.title,
91
+ duration: track.duration,
92
+ cover: track.album.cover_xl,
93
+ preview: track.preview,
94
+ link: track.link,
95
+ explicit: track.explicit,
96
+ download,
97
+ }
98
+ }
@@ -1,6 +1,9 @@
1
1
  export { ytInfo, ytDownload, ytSearch, getFileSize } from './youtube.js'
2
2
  export { youtubeDownload } from './youtubev2.js'
3
3
  export { tiktokInfo, tiktokDownload } from './tiktok.js'
4
+ export { tiktokSearch } from './tiktok.js'
5
+ export { snaptikDownload } from './snaptik.js'
6
+ export { deezerSearch, deezerTrack } from './deezer.js'
4
7
  export { fbDownload } from './facebook.js'
5
8
  export { tweetInfo, tweetDownload } from './twitter.js'
6
9
  export { mediafireInfo } from './mediafire.js'
@@ -0,0 +1,137 @@
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
+ import { createContext, runInContext } from 'vm'
11
+
12
+ 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'
13
+ const BASE = 'https://snaptik.app'
14
+ const HEADERS = { 'User-Agent': UA }
15
+
16
+ function decodeObfuscated(jsCode) {
17
+ const patched = jsCode
18
+ .replace(/eval\(function\(h,u,n,t,e,r\)/, 'decoded=(function(h,u,n,t,e,r)')
19
+ .replace(/\}\)\s*$/, '})')
20
+ try {
21
+ const ctx = createContext({ decoded: '' })
22
+ runInContext(patched, ctx, { timeout: 5000 })
23
+ return ctx.decoded || ''
24
+ } catch { return '' }
25
+ }
26
+
27
+ function extractInnerHTML(decoded) {
28
+ const marker = 'innerHTML = "'
29
+ const idx = decoded.indexOf(marker)
30
+ if (idx === -1) return ''
31
+ const start = idx + marker.length
32
+ const end = decoded.indexOf('"; $(', start)
33
+ if (end === -1) return ''
34
+ return decoded.slice(start, end)
35
+ .replace(/\\"/g, '"')
36
+ .replace(/\\n/g, '\n')
37
+ .replace(/\\\//g, '/')
38
+ }
39
+
40
+ export async function snaptikDownload(url) {
41
+ if (!url?.trim()) throw new Error('Se requiere una URL de TikTok')
42
+
43
+ const r0 = await axios.get(`${BASE}/en2`, {
44
+ headers: HEADERS,
45
+ timeout: 12000,
46
+ })
47
+ const $0 = cheerio.load(r0.data)
48
+ const token = $0('input[name="token"]').val() || ''
49
+ const cookies = r0.headers['set-cookie']?.map(c => c.split(';')[0]).join('; ') || ''
50
+
51
+ if (!token) throw new Error('No se pudo obtener el token de snaptik')
52
+
53
+ const params = new URLSearchParams({ url, token, lang: 'en2' })
54
+ const { data } = await axios.post(`${BASE}/abc2.php`, params, {
55
+ headers: {
56
+ ...HEADERS,
57
+ 'Content-Type': 'application/x-www-form-urlencoded',
58
+ 'Referer': `${BASE}/en2`,
59
+ 'Origin': BASE,
60
+ 'Cookie': cookies,
61
+ },
62
+ timeout: 15000,
63
+ })
64
+
65
+ const raw = typeof data === 'string' ? data : JSON.stringify(data)
66
+ const decoded = decodeObfuscated(raw)
67
+
68
+ if (!decoded) throw new Error('No se pudo decodificar el response de snaptik')
69
+
70
+ if (decoded.includes('showAlert')) {
71
+ const msgMatch = decoded.match(/showAlert\("([^"]+)"/)
72
+ throw new Error(msgMatch?.[1] || 'Error en snaptik al procesar la URL')
73
+ }
74
+
75
+ const html = extractInnerHTML(decoded)
76
+ if (!html) throw new Error('No se encontró HTML de descarga en el response')
77
+
78
+ const $ = cheerio.load(html)
79
+
80
+ const title = $('.video-title').text().trim()
81
+ const thumbnail = $('#thumbnail').attr('src') || $('img.avatar').attr('src') || ''
82
+
83
+ const btnToken = $('button.btn-render').attr('data-token') || ''
84
+ if (btnToken) {
85
+ let imageUrls = []
86
+ try {
87
+ const payload = btnToken.split('.')[1] || ''
88
+ const json = JSON.parse(Buffer.from(payload, 'base64').toString('utf8'))
89
+ imageUrls = json.image_urls || []
90
+ } catch {}
91
+
92
+ if (!imageUrls.length) {
93
+ $('img').each((_, el) => {
94
+ const src = $(el).attr('src') || ''
95
+ if (src.includes('tiktokcdn') && !src.includes('avatar')) {
96
+ imageUrls.push(src)
97
+ }
98
+ })
99
+ imageUrls = [...new Set(imageUrls)]
100
+ }
101
+
102
+ const downloadUrls = []
103
+ $('a[href*="rapidcdn"]').each((_, el) => {
104
+ const href = $(el).attr('href') || ''
105
+ if (href) downloadUrls.push(href)
106
+ })
107
+
108
+ if (imageUrls.length || downloadUrls.length) {
109
+ return {
110
+ title,
111
+ thumbnail,
112
+ type: 'images',
113
+ images: imageUrls,
114
+ imagesWm: downloadUrls,
115
+ source: 'snaptik',
116
+ }
117
+ }
118
+ }
119
+
120
+ const sdUrl = $('a.download-file').first().attr('href') || ''
121
+ const hdApiUrl = $('button[data-tokenhd]').attr('data-tokenhd') || ''
122
+ const hdBackup = $('button[data-backup]').attr('data-backup') || ''
123
+
124
+ if (!sdUrl) throw new Error('No se encontró URL de descarga')
125
+
126
+ return {
127
+ title,
128
+ thumbnail,
129
+ type: 'video',
130
+ download: {
131
+ sd: sdUrl,
132
+ hd: hdBackup || null,
133
+ hdApi: hdApiUrl || null,
134
+ },
135
+ source: 'snaptik',
136
+ }
137
+ }
@@ -0,0 +1,128 @@
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 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'
11
+ const BASE = 'https://api.deezer.com'
12
+
13
+ async function get(endpoint, params = {}) {
14
+ const { data } = await axios.get(`${BASE}${endpoint}`, {
15
+ params,
16
+ headers: { 'User-Agent': UA },
17
+ timeout: 12000,
18
+ })
19
+ if (data?.error) throw new Error(data.error.message || 'Error en Deezer API')
20
+ return data
21
+ }
22
+
23
+ function formatDuration(ms) {
24
+ if (!ms) return null
25
+ const s = Math.floor(ms / 1000)
26
+ const m = Math.floor(s / 60)
27
+ const sec = s % 60
28
+ return `${m}:${sec.toString().padStart(2, '0')}`
29
+ }
30
+
31
+ export async function deezerFind(query, limit = 10) {
32
+ if (!query?.trim()) throw new Error('Se requiere un término de búsqueda')
33
+ const data = await get('/search', { q: query, limit })
34
+ if (!data?.data?.length) throw new Error('Sin resultados')
35
+ return data.data.map(t => ({
36
+ id: t.id,
37
+ title: t.title,
38
+ artist: t.artist?.name,
39
+ artistId: t.artist?.id,
40
+ album: t.album?.title,
41
+ albumId: t.album?.id,
42
+ cover: t.album?.cover_medium,
43
+ coverHd: t.album?.cover_xl || t.album?.cover_big,
44
+ preview: t.preview,
45
+ duration: formatDuration(t.duration * 1000),
46
+ link: t.link,
47
+ rank: t.rank,
48
+ }))
49
+ }
50
+
51
+ export async function deezerSearchAlbum(query, limit = 10) {
52
+ if (!query?.trim()) throw new Error('Se requiere un término de búsqueda')
53
+ const data = await get('/search/album', { q: query, limit })
54
+ if (!data?.data?.length) throw new Error('Sin resultados')
55
+ return data.data.map(a => ({
56
+ id: a.id,
57
+ title: a.title,
58
+ artist: a.artist?.name,
59
+ artistId: a.artist?.id,
60
+ cover: a.cover_medium,
61
+ coverHd: a.cover_xl || a.cover_big,
62
+ tracks: a.nb_tracks,
63
+ releaseDate: a.release_date,
64
+ link: a.link,
65
+ }))
66
+ }
67
+
68
+ export async function deezerSearchArtist(query, limit = 10) {
69
+ if (!query?.trim()) throw new Error('Se requiere un término de búsqueda')
70
+ const data = await get('/search/artist', { q: query, limit })
71
+ if (!data?.data?.length) throw new Error('Sin resultados')
72
+ return data.data.map(a => ({
73
+ id: a.id,
74
+ name: a.name,
75
+ picture: a.picture_medium,
76
+ pictureHd: a.picture_xl || a.picture_big,
77
+ fans: a.nb_fan,
78
+ link: a.link,
79
+ }))
80
+ }
81
+
82
+ export async function deezerAlbumTracks(albumId, limit = 50) {
83
+ if (!albumId) throw new Error('Se requiere un ID de álbum')
84
+ const data = await get(`/album/${albumId}/tracks`, { limit })
85
+ if (!data?.data?.length) throw new Error('Sin tracks')
86
+ const album = await get(`/album/${albumId}`)
87
+ return {
88
+ id: album.id,
89
+ title: album.title,
90
+ artist: album.artist?.name,
91
+ cover: album.cover_medium,
92
+ coverHd: album.cover_xl || album.cover_big,
93
+ releaseDate: album.release_date,
94
+ genre: album.genres?.data?.[0]?.name || null,
95
+ tracks: data.data.map(t => ({
96
+ id: t.id,
97
+ title: t.title,
98
+ duration: formatDuration(t.duration * 1000),
99
+ preview: t.preview,
100
+ link: `https://www.deezer.com/track/${t.id}`,
101
+ }))
102
+ }
103
+ }
104
+
105
+ export async function deezerArtistTopTracks(artistId, limit = 10) {
106
+ if (!artistId) throw new Error('Se requiere un ID de artista')
107
+ const data = await get(`/artist/${artistId}/top`, { limit })
108
+ if (!data?.data?.length) throw new Error('Sin tracks')
109
+ const artist = await get(`/artist/${artistId}`)
110
+ return {
111
+ id: artist.id,
112
+ name: artist.name,
113
+ picture: artist.picture_medium,
114
+ pictureHd: artist.picture_xl || artist.picture_big,
115
+ fans: artist.nb_fan,
116
+ link: artist.link,
117
+ tracks: data.data.map(t => ({
118
+ id: t.id,
119
+ title: t.title,
120
+ album: t.album?.title,
121
+ cover: t.album?.cover_medium,
122
+ duration: formatDuration(t.duration * 1000),
123
+ preview: t.preview,
124
+ rank: t.rank,
125
+ link: `https://www.deezer.com/track/${t.id}`,
126
+ }))
127
+ }
128
+ }
@@ -9,6 +9,7 @@ export { ytSearch } from './youtube.js'
9
9
  export { googleSearch } from './google.js'
10
10
  export { giphy, gifNext, giphyBuffer } from './giphy.js'
11
11
  export { pinsearch, pinimg, pinvid } from './pinterest.js'
12
+ export { deezerFind, deezerSearchAlbum, deezerSearchArtist, deezerAlbumTracks, deezerArtistTopTracks } from './deezersearch.js'
12
13
  export { stickerSearch } from './stickersearch.js'
13
14
  export { animeImage } from './anime.js'
14
15
  export { wallpaperSearch } from './wallpaper.js'
package/src/tools/ia.js DELETED
@@ -1,74 +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
-
10
- 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'
11
- const BASE = 'https://api.delirius.store'
12
-
13
- const headers = { 'User-Agent': UA }
14
-
15
- export async function copilot(query) {
16
- if (!query) throw new Error('query es requerido')
17
- const { data } = await axios.get(`${BASE}/ia/copilot`, {
18
- params: { query },
19
- headers,
20
- timeout: 12000,
21
- })
22
- if (!data?.text) throw new Error('Sin respuesta')
23
- return {
24
- text: data.text,
25
- citations: data.citations || [],
26
- conversationId: data.conversationId || null,
27
- }
28
- }
29
-
30
- export async function gemini(query) {
31
- if (!query) throw new Error('query es requerido')
32
- const { data } = await axios.get(`${BASE}/ia/gemini`, {
33
- params: { query },
34
- headers,
35
- timeout: 12000,
36
- })
37
- if (!data?.status || !data?.data?.result) throw new Error('Sin respuesta')
38
- return { text: data.data.result }
39
- }
40
-
41
- export async function chatgpt(query) {
42
- if (!query) throw new Error('query es requerido')
43
- const { data } = await axios.get(`${BASE}/ia/chatgpt`, {
44
- params: { q: query },
45
- headers,
46
- timeout: 12000,
47
- })
48
- if (!data?.status || !data?.data) throw new Error('Sin respuesta')
49
- return { text: data.data }
50
- }
51
-
52
- export async function gptPrompt(text, prompt = '') {
53
- if (!text) throw new Error('text es requerido')
54
- const params = { text }
55
- if (prompt) params.prompt = prompt
56
- const { data } = await axios.get(`${BASE}/ia/gptprompt`, {
57
- params,
58
- headers,
59
- timeout: 12000,
60
- })
61
- if (!data?.status || !data?.data) throw new Error('Sin respuesta')
62
- return { text: data.data }
63
- }
64
-
65
- export async function ripleai(query) {
66
- if (!query) throw new Error('query es requerido')
67
- const { data } = await axios.get(`${BASE}/ia/ripleai`, {
68
- params: { query },
69
- headers,
70
- timeout: 12000,
71
- })
72
- if (!data?.status || !data?.data?.result) throw new Error('Sin respuesta')
73
- return { text: data.data.result }
74
- }