This repository was archived by the owner on Sep 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathexample.js
More file actions
69 lines (42 loc) · 2.69 KB
/
example.js
File metadata and controls
69 lines (42 loc) · 2.69 KB
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
59
60
61
62
63
64
65
66
67
68
69
require('./src/tools-for-instagram.js');
(async () => {
console.log("\n1 -- LOGIN --\n".bold.underline);
let ig = await login();
console.log("\n2 -- Get User Info -- \n".bold.underline);
let info = await getUserInfo(ig, "TheLinkfy");
console.log("User information, username: " + info.username);
console.log("\n3 -- Get Followers in .json file -- \n".bold.underline);
console.log("You can specify a max of iterations, like getFollowers(ig, Instargram, iterations = 2)\nEach iteration gets around 10.000 accounts".yellow);
await getFollowers(ig, 'linkfytester');
console.log("\n4 -- Trying to like URL --\n".bold.underline);
await likeUrl(ig, 'www.instagram.com/p/B1Jqqc3AS_0/');
await likeUrl(ig, 'https://www.instagram.com/p/B1Ele5pAHmg/');
await likeUrl(ig, 'https://www.instagram.com/p/B1CZhsqgS1Y');
console.log("\n5 -- Trying to get recent hashtag list and like the first item -- \n".bold.underline);
let posts = await recentHashtagList(ig, "dogs");
await likePost(ig, posts[0]);
console.log("\n6 -- Trying to get top hashtag list and like the first item -- \n".bold.underline);
posts = await topHashtagList(ig, "dogs");
await likePost(ig, posts[0]);
console.log("\n7 -- Trying to get recent location list and like the first item -- \n".bold.underline);
console.log("Getting the most accurated Location...\n[To get a randomized location of the search result specify 'true' at the end of function]\n- Example: recentLocationList(ig, 'Spain', true);".yellow);
posts = await recentLocationList(ig, "Spain");
await likePost(ig, posts[0]);
console.log("\n8 -- Trying to get top location list and like the first item -- \n".bold.underline);
console.log("Getting the most accurated Location...\n[To get a randomized location of the search result specify 'true' at the end of function]\n- Example: recentLocationList(ig, 'Spain', true);".yellow);
posts = await topLocationList(ig, "Spain");
await likePost(ig, posts[0]);
console.log("\n-- 9: Saving posts into a file \n".bold.underline);
posts = await recentHashtagList(ig, "dogs");
await savePosts(ig, posts, "dogs_posts");
posts = await recentHashtagList(ig, "cats");
await savePosts(ig, posts, "cats_posts");
console.log("\n-- 10: Follow User by username--\n".bold.underline);
await followUser(ig, 'Instagram');
await sleep(5);
console.log("\n-- 11: Unfollow User by username --\n".bold.underline);
await unfollowUser(ig, 'Instagram');
console.log("\nProcess done!\n".green);
// If ONLINE_MODE is enabled, this example will run until we send an exit signal
process.exit();
})();