-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbomlike.js
183 lines (168 loc) · 5.36 KB
/
bomlike.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
const Client = require('instagram-private-api').V1;
const delay = require('delay');
const chalk = require('chalk');
const _ = require('lodash');
const rp = require('request-promise');
const S = require('string');
const inquirer = require('inquirer');
const User = [
{
type:'input',
name:'username',
message:'[>] Insert Username:',
validate: function(value){
if(!value) return 'Can\'t Empty';
return true;
}
},
{
type:'password',
name:'password',
message:'[>] Insert Password:',
mask:'*',
validate: function(value){
if(!value) return 'Can\'t Empty';
return true;
}
},
{
type:'input',
name:'target',
message:'[>] Insert Username Target (Without @[at]):',
validate: function(value){
if(!value) return 'Can\'t Empty';
return true;
}
},
{
type:'input',
name:'mysyntx',
message:'[>] Input Total of Target You Want (ITTYW):',
validate: function(value){
value = value.match(/[0-9]/);
if (value) return true;
return 'Use Number Only!';
}
},
{
type:'input',
name:'sleep',
message:'[>] Insert Sleep (MiliSeconds):',
validate: function(value){
value = value.match(/[0-9]/);
if (value) return true;
return 'Delay is number';
}
}
]
const Login = async function(User){
const Device = new Client.Device(User.username);
const Storage = new Client.CookieMemoryStorage();
const session = new Client.Session(Device, Storage);
try {
await Client.Session.create(Device, Storage, User.username, User.password)
const account = await session.getAccount();
return Promise.resolve({session,account});
} catch (err) {
return Promise.reject(err);
}
}
const Target = async function(username){
const url = 'https://www.instagram.com/'+username+'/'
const option = {
url: url,
method: 'GET'
}
try{
const account = await rp(option);
const data = S(account).between('<script type="text/javascript">window._sharedData = ', ';</script>').s
const json = JSON.parse(data);
if (json.entry_data.ProfilePage[0].graphql.user.is_private) {
return Promise.reject('Target is private Account');
} else {
const id = json.entry_data.ProfilePage[0].graphql.user.id;
const followers = json.entry_data.ProfilePage[0].graphql.user.edge_followed_by.count;
return Promise.resolve({id,followers});
}
} catch (err){
return Promise.reject(err);
}
}
const Media = async function(session, id){
const Media = new Client.Feed.UserMedia(session, id);
try {
const Poto = [];
var cursor;
if (cursor) Media.setCursor(cursor);
const getPoto = await Media.get();
await Promise.all(getPoto.map(async(poto) => {
Poto.push({
id:poto.id,
link:poto.params.webLink
});
}))
cursor = await Media.getCursor()
return Promise.resolve(Poto);
} catch (err){
return Promise.reject(err);
}
}
async function ngeLike(session, id){
try{
await Client.Like.create(session, id)
return true;
} catch(e) {
return false;
}
}
const Excute = async function(User, TargetUsername, mysyntx, sleep){
try {
/** TRY TO LOGIN **/
console.log('\n');
console.log('[?] Try to Login . . .');
const doLogin = await Login(User);
console.log(chalk`{bold.green [!] Login Succsess!}`);
/** TRY TO GET ALL MEDIA **/
console.log('[?] Try to get Media . . .')
const getTarget = await Target(TargetUsername);
var getMedia = await Media(doLogin.session, getTarget.id);
console.log(chalk`{bold.green [!] Succsess to get Media From [${TargetUsername}] }\n`);
getMedia = _.chunk(getMedia, mysyntx);
/** TRY TO DELETE ALL MEDIA **/
for (let i = 0; i < getMedia.length; i++) {
console.log('[?] Try to Like Photo/Delay \n')
await Promise.all(getMedia[i].map(async(media) => {
const doDelete = await ngeLike(doLogin.session, media.id);
const PrintOut = chalk`> ${media.link} => ${doDelete ? chalk`{bold.green Sukses Like}` : chalk`{bold.red Gagal Like}`}`
console.log(PrintOut);
}))
console.log(chalk`{yellow \n [#][>] Delay For ${sleep} MiliSeconds [<][#] \n}`)
await delay(sleep)
}
console.log(chalk`{bold.green [+] Bom Like Post Succsess}`)
} catch (err) {
console.log(err);
}
}
console.log(chalk`
{bold.cyan
—————————————————— [INFORMATION] ————————————————————
[?] {bold.green BOM LIKE POST TARGET *SET SLEEP!}
—————————————————— [THANKS TO] ————————————————————
[✓] CODE BY CYBER SCREAMER CCOCOT (ccocot@bc0de.net)
[✓] FIXING & TESTING BY SYNTAX (@officialputu_id)
[✓] CCOCOT.CO | BC0DE.NET | NAONLAH.NET | WingkoColi
[✓] SGB TEAM REBORN | Zerobyte.id | ccocot@bc0de.net
—————————————————————————————————————————————————————
What's new?
1. Input Target/delay Manual (ITTYW)
—————————————————————————————————————————————————————}
`);
//ikiganteng
inquirer.prompt(User)
.then(answers => {
Excute({
username:answers.username,
password:answers.password
},answers.target,answers.mysyntx,answers.sleep);
})