Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@bochilteam/scraper/lib/cjs/social-media/test.js
1126 views
1
"use strict";
2
Object.defineProperty(exports, "__esModule", { value: true });
3
const chai_1 = require("chai");
4
const index_js_1 = require("./index.js");
5
describe('Social media', () => {
6
describe('Tiktok scraper', function () {
7
it('tiktokdl', function (done) {
8
(0, index_js_1.tiktokdl)('https://www.tiktok.com/@omagadsus/video/7025456384175017243?is_from_webapp=1&sender_device=pc&web_id6982004129280116226').then(function (res) {
9
(0, chai_1.expect)(res).to.be.an('object');
10
(0, chai_1.expect)(res.author).to.be.an('object');
11
(0, chai_1.expect)(res.author.nickname).to.be.a('string');
12
(0, chai_1.expect)(res.description).to.be.a('string');
13
(0, chai_1.expect)(res.video).to.be.an('object');
14
(0, chai_1.expect)(res.video.no_watermark).to.be.a('string');
15
(0, chai_1.expect)(res.video.no_watermark2).to.be.a('string');
16
(0, chai_1.expect)(res.video.no_watermark_raw).to.be.a('string');
17
return done();
18
}).catch(done);
19
});
20
it('tiktokdl v2', function (done) {
21
(0, index_js_1.tiktokdlv2)('https://www.tiktok.com/@omagadsus/video/7025456384175017243?is_from_webapp=1&sender_device=pc&web_id6982004129280116226').then(function (res) {
22
(0, chai_1.expect)(res).to.be.an('object');
23
(0, chai_1.expect)(res.author).to.be.an('object');
24
(0, chai_1.expect)(res.author.unique_id).to.be.a('string');
25
(0, chai_1.expect)(res.author.nickname).to.be.a('string');
26
(0, chai_1.expect)(res.author.avatar).to.be.a('string');
27
(0, chai_1.expect)(res.video).to.be.an('object');
28
(0, chai_1.expect)(res.video.no_watermark).to.be.a('string');
29
(0, chai_1.expect)(res.video.no_watermark_hd).to.be.a('string');
30
return done();
31
}).catch(done);
32
});
33
it('tiktokdl v3', function (done) {
34
(0, index_js_1.tiktokdlv3)('https://www.tiktok.com/@omagadsus/video/7025456384175017243?is_from_webapp=1&sender_device=pc&web_id6982004129280116226').then(function (res) {
35
(0, chai_1.expect)(res).to.be.an('object');
36
(0, chai_1.expect)(res.author).to.be.an('object');
37
(0, chai_1.expect)(res.author.nickname).to.be.a('string');
38
(0, chai_1.expect)(res.author.avatar).to.be.a('string');
39
(0, chai_1.expect)(res.description).to.be.a('string');
40
(0, chai_1.expect)(res.video).to.be.an('object');
41
(0, chai_1.expect)(res.video.no_watermark).to.be.a('string');
42
(0, chai_1.expect)(res.video.no_watermark2).to.be.a('string');
43
(0, chai_1.expect)(res.music).to.be.a('string');
44
return done();
45
}).catch(done);
46
});
47
// it('tiktokfyp', function (done) {
48
// tiktokfyp().then(function (res) {
49
// expect(res).to.be.an('array')
50
// expect(res.length).to.be.above(0)
51
// return done()
52
// }).catch(done)
53
// })
54
// it('tiktokstalk', function (done) {
55
// tiktokstalk('Tiktok').then(function (res) {
56
// expect(res).to.be.an('object')
57
// // expect(res.username).to.be.a('string')
58
// // expect(res.profile).to.be.a('string')
59
// // expect(res.avatar).to.be.a('string')
60
// // expect(res.verified).to.be.a('boolean') Github action error!
61
// // expect(res.following).to.be.a('string')
62
// // expect(res.followers).to.be.a('string')
63
// // expect(res.likes).to.be.a('string')
64
// // expect(res.description).to.be.a('string')
65
// return done()
66
// }).catch(done)
67
// })
68
});
69
describe('Instagram', () => {
70
it('Instagram Downloader', done => {
71
// https://www.instagram.com/p/CaHpoweBjmx/?utm_source=ig_web_copy_link
72
(0, index_js_1.instagramdl)('https://www.instagram.com/reel/CXK49yFLtJ_/?utm_source=ig_web_copy_link').then(res => {
73
(0, chai_1.expect)(res).to.be.an('array');
74
(0, chai_1.expect)(res).to.have.lengthOf.at.least(1);
75
res.forEach(({ thumbnail, url }) => {
76
(0, chai_1.expect)(thumbnail).to.be.a('string');
77
(0, chai_1.expect)(url).to.be.a('string');
78
});
79
return done();
80
}).catch(done);
81
});
82
it('Instagram Downloader V2', done => {
83
(0, index_js_1.instagramdlv2)('https://www.instagram.com/reel/CXK49yFLtJ_/?utm_source=ig_web_copy_link').then(res => {
84
(0, chai_1.expect)(res).to.be.an('array');
85
(0, chai_1.expect)(res).to.have.lengthOf.at.least(1);
86
res.forEach(({ thumbnail, url }) => {
87
(0, chai_1.expect)(thumbnail).to.be.a('string');
88
(0, chai_1.expect)(url).to.be.a('string');
89
});
90
return done();
91
}).catch(done);
92
});
93
it('Instagram Downloader V3', done => {
94
(0, index_js_1.instagramdlv3)('https://www.instagram.com/reel/CXK49yFLtJ_/?utm_source=ig_web_copy_link').then(res => {
95
(0, chai_1.expect)(res).to.be.an('array');
96
(0, chai_1.expect)(res).to.have.lengthOf.at.least(1);
97
res.forEach(({ thumbnail, url }) => {
98
(0, chai_1.expect)(thumbnail).to.be.a('string');
99
(0, chai_1.expect)(url).to.be.a('string');
100
});
101
return done();
102
}).catch(done);
103
});
104
it('Instagram Downloader V4', done => {
105
(0, index_js_1.instagramdlv4)('https://www.instagram.com/reel/CXK49yFLtJ_/?utm_source=ig_web_copy_link').then(res => {
106
(0, chai_1.expect)(res).to.be.an('array');
107
(0, chai_1.expect)(res).to.have.lengthOf.at.least(1);
108
res.forEach(({ thumbnail, url }) => {
109
(0, chai_1.expect)(thumbnail).to.be.a('string');
110
(0, chai_1.expect)(url).to.be.a('string');
111
});
112
return done();
113
}).catch(done);
114
});
115
it('Instagram Story', function (done) {
116
(0, index_js_1.instagramStory)('raffinagita1717').then(res => {
117
(0, chai_1.expect)(res).to.be.an('object');
118
(0, chai_1.expect)(res.user).to.be.an('object');
119
(0, chai_1.expect)(res.results).to.be.an('array');
120
(0, chai_1.expect)(res.results).to.have.lengthOf.at.least(1);
121
res.results.forEach(({ thumbnail, url, type, isVideo }) => {
122
(0, chai_1.expect)(thumbnail).to.be.a('string');
123
(0, chai_1.expect)(url).to.be.a('string');
124
(0, chai_1.expect)(type).to.be.a('string');
125
(0, chai_1.expect)(isVideo).to.be.a('boolean');
126
});
127
return done();
128
}).catch(done);
129
});
130
it('Instagram Story V2', function (done) {
131
(0, index_js_1.instagramStoryv2)('raffinagita1717').then(res => {
132
(0, chai_1.expect)(res).to.be.an('object');
133
(0, chai_1.expect)(res.user).to.be.an('object');
134
(0, chai_1.expect)(res.results).to.be.an('array');
135
(0, chai_1.expect)(res.results).to.have.lengthOf.at.least(1);
136
res.results.forEach(({ thumbnail, isVideo, url }) => {
137
(0, chai_1.expect)(thumbnail).to.be.a('string');
138
(0, chai_1.expect)(isVideo).to.be.a('boolean');
139
(0, chai_1.expect)(url).to.be.a('string');
140
});
141
return done();
142
}).catch(done);
143
});
144
it('Instagram Stalk', done => {
145
(0, index_js_1.instagramStalk)('freefirebgid').then(res => {
146
(0, chai_1.expect)(res).to.be.an('object');
147
(0, chai_1.expect)(res.name).to.be.a('string');
148
(0, chai_1.expect)(res.username).to.be.a('string');
149
(0, chai_1.expect)(res.description).to.be.a('string');
150
(0, chai_1.expect)(res.postsH).to.be.a('string');
151
(0, chai_1.expect)(res.posts).to.be.a('number');
152
(0, chai_1.expect)(res.followersH).to.be.a('string');
153
(0, chai_1.expect)(res.followers).to.be.a('number');
154
(0, chai_1.expect)(res.followingH).to.be.a('string');
155
(0, chai_1.expect)(res.following).to.be.a('number');
156
return done();
157
}).catch(done);
158
});
159
});
160
describe('Facebook (Metaverse :V)', function () {
161
it('Facebook Downloader', done => {
162
(0, index_js_1.facebookdl)('https://fb.watch/9WktuN9j-z/').then(res => {
163
(0, chai_1.expect)(res).to.be.an('object');
164
(0, chai_1.expect)(res.id).to.be.a('string');
165
(0, chai_1.expect)(res.thumbnail).to.be.a('string');
166
(0, chai_1.expect)(res.duration).to.be.a('number');
167
(0, chai_1.expect)(res.result).to.be.an('array');
168
(0, chai_1.expect)(res.result).to.have.lengthOf.at.least(1);
169
res.result.forEach(({ ext, url, isVideo, isAudio }) => {
170
(0, chai_1.expect)(ext).to.be.a('string');
171
(0, chai_1.expect)(url).to.be.a('string');
172
(0, chai_1.expect)(isVideo).to.be.a('boolean');
173
(0, chai_1.expect)(isAudio).to.be.a('boolean');
174
});
175
return done();
176
}).catch(done);
177
});
178
it('Facebook Downloader V2', done => {
179
(0, index_js_1.facebookdlv2)('https://fb.watch/9WktuN9j-z/').then(res => {
180
(0, chai_1.expect)(res).to.be.an('object');
181
(0, chai_1.expect)(res.id).to.be.a('string');
182
(0, chai_1.expect)(res.title).to.be.a('string');
183
(0, chai_1.expect)(res.description).to.be.a('string');
184
(0, chai_1.expect)(res.thumbnail).to.be.a('string');
185
(0, chai_1.expect)(res.result).to.be.an('array');
186
(0, chai_1.expect)(res.result).to.have.lengthOf.at.least(1);
187
res.result.forEach(({ quality, url }) => {
188
(0, chai_1.expect)(quality).to.be.a('string');
189
(0, chai_1.expect)(url).to.be.a('string');
190
});
191
return done();
192
}).catch(done);
193
});
194
it('Facebook Downloader V3', done => {
195
(0, index_js_1.facebookdlv3)('https://fb.watch/9WktuN9j-z/').then(res => {
196
(0, chai_1.expect)(res).to.be.an('object');
197
(0, chai_1.expect)(res.title).to.be.a('string');
198
(0, chai_1.expect)(res.thumbnail).to.be.a('string');
199
(0, chai_1.expect)(res.result).to.be.an('array');
200
(0, chai_1.expect)(res.result).to.have.lengthOf.at.least(1);
201
res.result.forEach(({ url, quality, isAudio, isVideo }) => {
202
(0, chai_1.expect)(url).to.be.a('string');
203
(0, chai_1.expect)(quality).to.be.a('string');
204
(0, chai_1.expect)(isAudio).to.be.a('boolean');
205
(0, chai_1.expect)(isVideo).to.be.a('boolean');
206
});
207
return done();
208
}).catch(done);
209
});
210
});
211
describe('Twitter', () => {
212
it('Twitter Downloader', done => {
213
(0, index_js_1.twitterdl)('https://twitter.com/jen_degen/status/1458167531869458440?s=20').then(res => {
214
(0, chai_1.expect)(res).to.be.an('array');
215
res.forEach(({ quality, type, url, isVideo }) => {
216
(0, chai_1.expect)(quality).to.be.a('string');
217
(0, chai_1.expect)(type).to.be.a('string');
218
(0, chai_1.expect)(url).to.be.a('string');
219
(0, chai_1.expect)(isVideo).to.be.a('boolean');
220
});
221
return done();
222
}).catch(done);
223
});
224
it('Twitter Downloader V2', done => {
225
(0, index_js_1.twitterdlv2)('https://twitter.com/jen_degen/status/1458167531869458440?s=20').then(res => {
226
(0, chai_1.expect)(res).to.be.an('array');
227
res.forEach(({ quality, type, url }) => {
228
(0, chai_1.expect)(quality).to.be.a('string');
229
(0, chai_1.expect)(type).to.be.a('string');
230
(0, chai_1.expect)(url).to.be.a('string');
231
});
232
return done();
233
}).catch(done);
234
});
235
});
236
describe('Youtube', function () {
237
it('Youtube Downloader', done => {
238
(0, index_js_1.youtubedl)('https://youtu.be/iik25wqIuFo').then(res => {
239
res.video['360p'].download().catch(done);
240
(0, chai_1.expect)(res).to.be.an('object');
241
(0, chai_1.expect)(res.thumbnail).to.be.a('string');
242
(0, chai_1.expect)(res.title).to.be.a('string');
243
(0, chai_1.expect)(res.video).to.be.an('object');
244
(0, chai_1.expect)(res.audio).to.be.an('object');
245
return done();
246
}).catch(done);
247
});
248
it('Youtube Downloader v2', done => {
249
(0, index_js_1.youtubedlv2)('https://youtu.be/iik25wqIuFo').then(res => {
250
res.video['240p'].download().catch(done);
251
(0, chai_1.expect)(res).to.be.an('object');
252
(0, chai_1.expect)(res.thumbnail).to.be.a('string');
253
(0, chai_1.expect)(res.title).to.be.a('string');
254
(0, chai_1.expect)(res.video).to.be.an('object');
255
(0, chai_1.expect)(res.audio).to.be.an('object');
256
return done();
257
}).catch(done);
258
});
259
it('Youtube Downloader v3', done => {
260
(0, index_js_1.youtubedlv3)('https://youtu.be/iik25wqIuFo').then(res => {
261
res.video['360'].download().catch(done);
262
(0, chai_1.expect)(res).to.be.an('object');
263
(0, chai_1.expect)(res.thumbnail).to.be.a('string');
264
(0, chai_1.expect)(res.title).to.be.a('string');
265
(0, chai_1.expect)(res.video).to.be.an('object');
266
(0, chai_1.expect)(res.audio).to.be.an('object');
267
return done();
268
}).catch(done);
269
});
270
it('Youtube Search', done => {
271
(0, index_js_1.youtubeSearch)('Minecraft').then(res => {
272
(0, chai_1.expect)(res).to.be.an('object');
273
(0, chai_1.expect)(res.video).to.be.an('array');
274
(0, chai_1.expect)(res.video).to.have.lengthOf.at.least(1);
275
(0, chai_1.expect)(res.channel).to.be.an('array');
276
(0, chai_1.expect)(res.playlist).to.be.an('array');
277
return done();
278
}).catch(done);
279
});
280
});
281
it('Google It', done => {
282
(0, index_js_1.googleIt)('Minecraft').then(res => {
283
(0, chai_1.expect)(res).to.be.an('object');
284
(0, chai_1.expect)(res.info).to.be.an('object');
285
(0, chai_1.expect)(res.articles).to.be.an('array');
286
(0, chai_1.expect)(res.articles).to.have.lengthOf.at.least(1);
287
return done();
288
}).catch(done);
289
});
290
it('Group Whatsapp', done => {
291
(0, index_js_1.groupWA)('A').then(res => {
292
(0, chai_1.expect)(res).to.be.an('array');
293
(0, chai_1.expect)(res).to.have.lengthOf.at.least(1);
294
res.forEach(({ url, subject }) => {
295
(0, chai_1.expect)(url).to.be.a('string');
296
(0, chai_1.expect)(subject).to.be.a('string');
297
});
298
return done();
299
}).catch(done);
300
});
301
describe('aiovideodl', () => {
302
it('Tiktok download', done => {
303
(0, index_js_1.aiovideodl)('https://www.tiktok.com/@omagadsus/video/7025456384175017243?is_from_webapp=1&sender_device=pc&web_id6982004129280116226').then(res => {
304
(0, chai_1.expect)(res).to.be.an('object');
305
(0, chai_1.expect)(res.medias).to.be.an('array');
306
(0, chai_1.expect)(res.medias).to.have.lengthOf.at.least(1);
307
(0, chai_1.expect)(res.source).to.be.eq('tiktok');
308
return done();
309
}).catch(done);
310
});
311
it('Facebook download', done => {
312
(0, index_js_1.aiovideodl)('https://fb.watch/9WktuN9j-z/').then(res => {
313
(0, chai_1.expect)(res).to.be.an('object');
314
(0, chai_1.expect)(res.medias).to.be.an('array');
315
(0, chai_1.expect)(res.medias).to.have.lengthOf.at.least(1);
316
(0, chai_1.expect)(res.source).to.be.eq('facebook');
317
return done();
318
}).catch(done);
319
});
320
it('Twitter download', done => {
321
(0, index_js_1.aiovideodl)('https://twitter.com/jen_degen/status/1458167531869458440?s=20').then(res => {
322
(0, chai_1.expect)(res).to.be.an('object');
323
(0, chai_1.expect)(res.medias).to.be.an('array');
324
(0, chai_1.expect)(res.medias).to.have.lengthOf.at.least(1);
325
(0, chai_1.expect)(res.source).to.be.eq('twitter');
326
return done();
327
}).catch(done);
328
});
329
});
330
describe('Savefrom', () => {
331
it('Tiktok download', done => {
332
(0, index_js_1.savefrom)('https://www.tiktok.com/@omagadsus/video/7025456384175017243?is_from_webapp=1&sender_device=pc&web_id6982004129280116226').then(res => {
333
(0, chai_1.expect)(res).to.be.an('object');
334
(0, chai_1.expect)(res.url).to.be.an('array');
335
(0, chai_1.expect)(res.url).to.have.lengthOf.at.least(1);
336
(0, chai_1.expect)(res.hosting).to.be.eq('tiktok.com');
337
return done();
338
}).catch(done);
339
});
340
it('Facebook download', done => {
341
(0, index_js_1.savefrom)('https://fb.watch/9WktuN9j-z/').then(res => {
342
(0, chai_1.expect)(res).to.be.an('object');
343
(0, chai_1.expect)(res.url).to.be.an('array');
344
(0, chai_1.expect)(res.url).to.have.lengthOf.at.least(1);
345
(0, chai_1.expect)(res.hosting).to.be.eq('facebook.com');
346
return done();
347
}).catch(done);
348
});
349
it('Twitter download', done => {
350
(0, index_js_1.savefrom)('https://twitter.com/jen_degen/status/1458167531869458440?s=20').then(res => {
351
(0, chai_1.expect)(res).to.be.an('object');
352
(0, chai_1.expect)(res.url).to.be.an('array');
353
(0, chai_1.expect)(res.url).to.have.lengthOf.at.least(1);
354
(0, chai_1.expect)(res.hosting).to.be.eq('twitter.com');
355
return done();
356
}).catch(done);
357
});
358
it('Instagram download', done => {
359
(0, index_js_1.savefrom)('https://www.instagram.com/reel/CXK49yFLtJ_/?utm_source=ig_web_copy_link').then(res => {
360
(0, chai_1.expect)(res).to.be.an('object');
361
(0, chai_1.expect)(res.url).to.be.an('array');
362
(0, chai_1.expect)(res.url).to.have.lengthOf.at.least(1);
363
(0, chai_1.expect)(res.hosting).to.be.eq('instagram.com');
364
return done();
365
}).catch(done);
366
});
367
});
368
});
369
//# sourceMappingURL=test.js.map
370