devworldbr-api 1.0.0 → 1.0.2
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 +283 -4
- package/index.js +62 -6
- package/package.json +4 -1
- package/config/config.json +0 -6
package/README.md
CHANGED
|
@@ -1,8 +1,287 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">devworldbr-api
|
|
2
2
|
|
|
3
|
-
SDK
|
|
3
|
+
SDK oficial para integração com as APIs da Dev World BR.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Acesse, de forma simples, os recursos de downloads, mídias, ferramentas e serviços disponibilizados pela plataforma.
|
|
6
|
+
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://www.npmjs.com/package/devworldbr-api">
|
|
9
|
+
<img src="https://img.shields.io/npm/v/devworldbr-api.svg?style=flat-square" alt="NPM Version">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/devworldbr-api">
|
|
12
|
+
<img src="https://img.shields.io/npm/dm/devworldbr-api.svg?style=flat-square" alt="NPM Downloads">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://api.devworldbr.site">
|
|
15
|
+
<img src="https://img.shields.io/badge/DevWorld%20BR-API-005955?style=flat-square" alt="DevWorld BR">
|
|
16
|
+
</a>
|
|
17
|
+
</p></div>---
|
|
18
|
+
|
|
19
|
+
Sobre
|
|
20
|
+
|
|
21
|
+
O "devworldbr-api" é o SDK oficial da Dev World BR, criado para facilitar o consumo dos endpoints da plataforma diretamente em projetos Node.js.
|
|
22
|
+
|
|
23
|
+
Com ele, você pode utilizar recursos de download, pesquisa, ferramentas e outros serviços através de métodos simples.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
Requisitos
|
|
28
|
+
|
|
29
|
+
- Node.js
|
|
30
|
+
- Uma conta na Dev World BR
|
|
31
|
+
- Uma "apiKey" válida
|
|
32
|
+
|
|
33
|
+
Obtendo sua API Key
|
|
34
|
+
|
|
35
|
+
1. Acesse o site oficial: https://api.devworldbr.site
|
|
36
|
+
2. Crie sua conta.
|
|
37
|
+
3. Ative uma chave API através de um dos planos disponíveis.
|
|
38
|
+
4. Copie sua "apiKey" pelo painel.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
Instalação
|
|
43
|
+
|
|
44
|
+
Instale o pacote utilizando o npm:
|
|
6
45
|
|
|
7
|
-
```bash
|
|
8
46
|
npm install devworldbr-api
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
Inicialização
|
|
51
|
+
|
|
52
|
+
CommonJS
|
|
53
|
+
|
|
54
|
+
const DevWorldBR = require('devworldbr-api');
|
|
55
|
+
|
|
56
|
+
const api = new DevWorldBR({
|
|
57
|
+
apiKey: 'SUA_API_KEY_AQUI'
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
ESM
|
|
61
|
+
|
|
62
|
+
import DevWorldBR from 'devworldbr-api';
|
|
63
|
+
|
|
64
|
+
const api = new DevWorldBR({
|
|
65
|
+
apiKey: 'SUA_API_KEY_AQUI'
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
Downloads e mídias
|
|
71
|
+
|
|
72
|
+
Todos os métodos abaixo são chamados diretamente através da instância "api".
|
|
73
|
+
|
|
74
|
+
YouTube — Play Vídeo
|
|
75
|
+
|
|
76
|
+
Retorna o conteúdo do vídeo em "Buffer".
|
|
77
|
+
|
|
78
|
+
const video = await api.playVideo('música de exemplo');
|
|
79
|
+
|
|
80
|
+
console.log(video);
|
|
81
|
+
|
|
82
|
+
«"playVideo()" é o método destinado ao retorno direto do arquivo em Buffer.»
|
|
83
|
+
|
|
84
|
+
YouTube — Play Áudio
|
|
85
|
+
|
|
86
|
+
const audio = await api.playAudio('música de exemplo');
|
|
87
|
+
|
|
88
|
+
console.log(audio);
|
|
89
|
+
|
|
90
|
+
YouTube — Download por link
|
|
91
|
+
|
|
92
|
+
const result = await api.ytdl(
|
|
93
|
+
'https://youtube.com/watch?v=xxx'
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
console.log(result);
|
|
97
|
+
|
|
98
|
+
TikTok — Vídeo
|
|
99
|
+
|
|
100
|
+
const result = await api.ttkdl(
|
|
101
|
+
'https://vm.tiktok.com/xxx'
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
console.log(result);
|
|
105
|
+
|
|
106
|
+
TikTok — Imagens / Slides
|
|
107
|
+
|
|
108
|
+
const result = await api.ttkimg(
|
|
109
|
+
'https://vm.tiktok.com/xxx'
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
console.log(result);
|
|
113
|
+
|
|
114
|
+
Kwai
|
|
115
|
+
|
|
116
|
+
const result = await api.kwaidl(
|
|
117
|
+
'https://kwai-video.com/p/xxx'
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
console.log(result);
|
|
121
|
+
|
|
122
|
+
Pinterest
|
|
123
|
+
|
|
124
|
+
Aceita termo de pesquisa ou link, dependendo do método utilizado pela API.
|
|
125
|
+
|
|
126
|
+
const result = await api.pinterest('anime aesthetic');
|
|
127
|
+
|
|
128
|
+
console.log(result);
|
|
129
|
+
|
|
130
|
+
Spotify
|
|
131
|
+
|
|
132
|
+
const result = await api.spotify(
|
|
133
|
+
'https://open.spotify.com/track/xxx'
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
console.log(result);
|
|
137
|
+
|
|
138
|
+
Instagram
|
|
139
|
+
|
|
140
|
+
Suporte para conteúdos como Reels e Posts.
|
|
141
|
+
|
|
142
|
+
const result = await api.igdl(
|
|
143
|
+
'https://www.instagram.com/p/xxx'
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
console.log(result);
|
|
147
|
+
|
|
148
|
+
Facebook
|
|
149
|
+
|
|
150
|
+
const result = await api.FacebookDL(
|
|
151
|
+
'https://www.facebook.com/watch/?v=xxx'
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
console.log(result);
|
|
155
|
+
|
|
156
|
+
SoundCloud
|
|
157
|
+
|
|
158
|
+
const result = await api.SoundCloudDL(
|
|
159
|
+
'https://soundcloud.com/user/track'
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
console.log(result);
|
|
163
|
+
|
|
164
|
+
MediaFire
|
|
165
|
+
|
|
166
|
+
const result = await api.mediafireDL(
|
|
167
|
+
'https://www.mediafire.com/file/xxx'
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
console.log(result);
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
Ferramentas
|
|
175
|
+
|
|
176
|
+
Shazam
|
|
177
|
+
|
|
178
|
+
Utilize o método para identificar músicas a partir de uma URL de áudio.
|
|
179
|
+
|
|
180
|
+
const result = await api.shazam(
|
|
181
|
+
'https://meusite.com/audio.mp3'
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
console.log(result);
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
Retornos
|
|
189
|
+
|
|
190
|
+
Por padrão, os métodos da SDK retornam os dados fornecidos pela API em formato JSON.
|
|
191
|
+
|
|
192
|
+
A exceção é o método:
|
|
193
|
+
|
|
194
|
+
api.playVideo()
|
|
195
|
+
|
|
196
|
+
que retorna o conteúdo do vídeo diretamente em Buffer.
|
|
197
|
+
|
|
198
|
+
Exemplo:
|
|
199
|
+
|
|
200
|
+
const video = await api.playVideo('música de exemplo');
|
|
201
|
+
|
|
202
|
+
console.log(Buffer.isBuffer(video));
|
|
203
|
+
// true
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
Exemplo completo
|
|
208
|
+
|
|
209
|
+
Um exemplo simples utilizando a SDK:
|
|
210
|
+
|
|
211
|
+
const DevWorldBR = require('devworldbr-api');
|
|
212
|
+
|
|
213
|
+
const api = new DevWorldBR({
|
|
214
|
+
apiKey: 'SUA_API_KEY_AQUI'
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
async function main() {
|
|
218
|
+
try {
|
|
219
|
+
const result = await api.spotify(
|
|
220
|
+
'https://open.spotify.com/track/xxx'
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
console.log(result);
|
|
224
|
+
} catch (error) {
|
|
225
|
+
console.error('Erro ao realizar a requisição:', error);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
main();
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
Plataformas disponíveis
|
|
234
|
+
|
|
235
|
+
Plataforma| Recurso
|
|
236
|
+
YouTube| Vídeo, áudio e download por link
|
|
237
|
+
TikTok| Vídeos e imagens/slides
|
|
238
|
+
Kwai| Download de vídeos
|
|
239
|
+
Pinterest| Pesquisa e mídias
|
|
240
|
+
Spotify| Download de faixas
|
|
241
|
+
Instagram| Reels e Posts
|
|
242
|
+
Facebook| Download de vídeos
|
|
243
|
+
SoundCloud| Download de áudios
|
|
244
|
+
MediaFire| Extração de arquivos
|
|
245
|
+
Shazam| Reconhecimento musical
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
Métodos disponíveis
|
|
250
|
+
|
|
251
|
+
playVideo()
|
|
252
|
+
playAudio()
|
|
253
|
+
ytdl()
|
|
254
|
+
ttkdl()
|
|
255
|
+
ttkimg()
|
|
256
|
+
kwaidl()
|
|
257
|
+
pinterest()
|
|
258
|
+
spotify()
|
|
259
|
+
igdl()
|
|
260
|
+
FacebookDL()
|
|
261
|
+
SoundCloudDL()
|
|
262
|
+
mediafireDL()
|
|
263
|
+
shazam()
|
|
264
|
+
|
|
265
|
+
Os métodos podem receber parâmetros diferentes de acordo com o recurso utilizado.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
Links
|
|
270
|
+
|
|
271
|
+
API:
|
|
272
|
+
https://api.devworldbr.site
|
|
273
|
+
|
|
274
|
+
NPM:
|
|
275
|
+
https://www.npmjs.com/package/devworldbr-api
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
<div align="center">DevWorld BR
|
|
280
|
+
|
|
281
|
+
SDK oficial para integração com a API da Dev World BR.
|
|
282
|
+
|
|
283
|
+
Desenvolvido por DevWorld BR
|
|
284
|
+
|
|
285
|
+
https://api.devworldbr.site
|
|
286
|
+
|
|
287
|
+
</div>
|
package/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
1
|
const axios = require('axios');
|
|
4
|
-
const config =
|
|
2
|
+
const { config } = require('./package.json');
|
|
5
3
|
|
|
6
4
|
class DevWorldBR {
|
|
7
5
|
constructor(options = {}) {
|
|
8
|
-
this.baseURL = config.baseURL || 'https://api.devworldbr.site';
|
|
6
|
+
this.baseURL = config.baseURL || options.baseURL || 'https://api.devworldbr.site';
|
|
9
7
|
this.apiKey = options.apiKey;
|
|
10
8
|
|
|
11
9
|
if (!this.apiKey) {
|
|
@@ -30,16 +28,74 @@ class DevWorldBR {
|
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
|
|
31
|
+
// Downloads & Mídia
|
|
33
32
|
async playVideo(query) {
|
|
34
33
|
if (!query) throw new Error('O parâmetro "query" é obrigatório.');
|
|
35
34
|
return await this._get('/api/downloads/youtube/play/video/v1', { query }, 'arraybuffer');
|
|
36
35
|
}
|
|
36
|
+
|
|
37
|
+
async playAudio(query) {
|
|
38
|
+
if (!query) throw new Error('O parâmetro "query" é obrigatório.');
|
|
39
|
+
return await this._get('/api/downloads/youtube/play/audio/v1', { query });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async ytdl(link) {
|
|
43
|
+
if (!link) throw new Error('O parâmetro "link" é obrigatório.');
|
|
44
|
+
return await this._get('/api/downloads/youtube/dl/v1', { link });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async ttkdl(link) {
|
|
48
|
+
if (!link) throw new Error('O parâmetro "link" é obrigatório.');
|
|
49
|
+
return await this._get('/api/downloads/tiktok/dl/v1', { link });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async ttkimg(link) {
|
|
53
|
+
if (!link) throw new Error('O parâmetro "link" é obrigatório.');
|
|
54
|
+
return await this._get('/api/downloads/tiktok/imagens/v1', { link });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async kwaidl(link) {
|
|
58
|
+
if (!link) throw new Error('O parâmetro "link" é obrigatório.');
|
|
59
|
+
return await this._get('/api/downloads/kwai/dl/v1', { link });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async pinterest(query) {
|
|
63
|
+
if (!query) throw new Error('Informe um termo de busca ou URL do Pinterest.');
|
|
64
|
+
return await this._get('/api/downloads/pinterest/dl/v1', { query_ou_url: query });
|
|
65
|
+
}
|
|
37
66
|
|
|
67
|
+
async spotify(link) {
|
|
68
|
+
if (!link) throw new Error('O parâmetro "link" é obrigatório.');
|
|
69
|
+
return await this._get('/api/downloads/spotify/dl/v1', { link });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async igdl(link) {
|
|
73
|
+
if (!link) throw new Error('O parâmetro "link" é obrigatório.');
|
|
74
|
+
return await this._get('/api/downloads/instagran/dl/v1', { link });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async SoundCloudDL(link) {
|
|
78
|
+
if (!link) throw new Error('O parâmetro "link" é obrigatório.');
|
|
79
|
+
return await this._get('/api/downloads/soundcloud/dl/v1', { link });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async mediafireDL(link) {
|
|
83
|
+
if (!link) throw new Error('O parâmetro "link" é obrigatório.');
|
|
84
|
+
return await this._get('/api/downloads/mediafire/dl/v1', { link });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async FacebookDL(link) {
|
|
88
|
+
if (!link) throw new Error('O parâmetro "link" é obrigatório.');
|
|
89
|
+
return await this._get('/api/downloads/facebook/dl/v1', { link });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Ferramentas & IA
|
|
38
93
|
async shazam(audioUrl) {
|
|
94
|
+
if (!audioUrl) throw new Error('O parâmetro "audioUrl" é obrigatório.');
|
|
39
95
|
return await this._get('/api/ferramentas/shazam/v1', { url: audioUrl });
|
|
40
96
|
}
|
|
41
|
-
|
|
42
97
|
}
|
|
43
98
|
|
|
44
99
|
module.exports = DevWorldBR;
|
|
45
|
-
|
|
100
|
+
module.exports.default = DevWorldBR;
|
|
101
|
+
module.exports.DevWorldBR = DevWorldBR;
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devworldbr-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "SDK oficial para consumo rápido das APIs DevWorld BR",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"config": {
|
|
7
|
+
"baseURL": "https://api.devworldbr.site"
|
|
8
|
+
},
|
|
6
9
|
"scripts": {
|
|
7
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
11
|
},
|