-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
58 lines (45 loc) · 1.15 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const dotenv = require('dotenv');
dotenv.config();
const crawler = require('./src');
loadLite = async () => {
try {
let media = await crawler.lite("permanahendra", { raw: false });
console.log(JSON.stringify(media));
} catch (error) {
console.log(error)
}
}
load = async () => {
try {
let options = {
raw: false,
username: 'invikard.demo',
query_hash: 'f2405b236d85e8296cf30347c9f08c2a',
media_count: -1,
cookie: process.env.COOKIE,
debug: true
}
let media = await crawler.start(options);
if (options.raw)
console.log(JSON.stringify(media.data));
else
console.log(media.length)
} catch (error) {
console.log(error)
}
}
loadComments = async () =>{
let comments = new crawler.Comments({
cookie: process.env.COOKIE,
});
try {
let result = await comments.getComments({
shortcode: "B1h04knHAEi"
})
console.log(JSON.stringify(result));
} catch (error) {
console.log(error);
}
}
//loadComments();
load();