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