-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhashtag.php
98 lines (96 loc) · 3.24 KB
/
hashtag.php
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
<?php
$accounts = json_decode(file_get_contents('accounts.json'),1);
$config = json_decode(file_get_contents('config.json'),1);
$file = $config['for'];
$id = $config['id'];
$words = explode(' ',$config['words']);
$token = $config['token'];
include 'index.php';
$a = file_exists('a') ? file_get_contents('a') : 'ap';
if($a == 'new'){
file_put_contents($file, '');
}
$from = 'HashTag';
$mid = bot('sendMessage',[
'chat_id'=>$id,
'text'=>"*Collection From* ~ [ _ $from _ ]\n\n*Status* ~> _ Working _\n*Users* ~> _ ".count(explode("\n", file_get_contents($file)))."_",
'parse_mode'=>'markdown',
'reply_markup'=>json_encode(['inline_keyboard'=>[
[['text'=>'Stop.','callback_data'=>'stopgr']]
]])
])->result->message_id;
$tag = urlencode($config['words']);
$url = "https://i.instagram.com/api/v1/feed/tag/$tag/?rank_token=caf8d67a-5140-4fcd-a795-e2a9047dc5d9";
$ids = [];
$posts = [];
$explore = curl_init();
curl_setopt($explore, CURLOPT_URL, $url);
curl_setopt($explore, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($explore, CURLOPT_HTTPHEADER, array(
'Host: i.instagram.com',
'Connection: keep-alive',
'X-IG-Connection-Type: WIFI',
'X-IG-Capabilities: 3Ro=',
'Accept-Language: ar-AE',
'Cookie: '.$accounts[$file]['cookies'],
'User-Agent: '.$accounts[$file]['useragent']
));
$res = curl_exec($explore);
curl_close($explore);
$json = json_decode($res);
file_put_contents('tag', json_encode($json,JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
foreach($json->ranked_items as $item){
if(!in_array($item->id, $posts)){
$posts[] = $item->id;
}
}
echo "Done ~ ".count($posts).PHP_EOL;
$for = $config['for'];
$i = 0;
$e = 43;
foreach($posts as $post){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://i.instagram.com/api/v1/media/".$post."/likers/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'x-ig-capabilities: 3w==',
'host: i.instagram.com',
'X-CSRFToken: missing',
'X-Instagram-AJAX: 1',
'Content-Type: application/x-www-form-urlencoded',
'X-Requested-With: XMLHttpRequest',
'Cookie: '.$accounts[$file]['cookies'],
'User-Agent: '.$accounts[$file]['useragent'],
'Connection: keep-alive'
));
$res = curl_exec($ch);
$likers = json_decode($res)->users;
curl_close($ch);
foreach($likers as $user){
if(!in_array($user->username, $ids)){
$ids[] = $user->username;
file_put_contents($file, $user->username."\n",FILE_APPEND);
echo "$i ~ ".$user->username.PHP_EOL;
if($i == $e){
bot('editmessageText',[
'chat_id'=>$id,
'message_id'=>$mid,
'text'=>"*Collection From* ~ [ _ $from _ ]\n\n*Status* ~> _ Working _\n*Users* ~> _ ".count(explode("\n", file_get_contents($file)))."_",
'parse_mode'=>'markdown',
'reply_markup'=>json_encode(['inline_keyboard'=>[
[['text'=>'Stop.','callback_data'=>'stopgr']]
]])
]);
$e += 43;
}
$i++;
}
}
sleep(1);
}
bot('sendMessage',[
'chat_id'=>$id,
'reply_to_message_id'=>$mid,
'text'=>"*Done Collection . * \n All : ".count(explode("\n", file_get_contents($file))),
'parse_mode'=>'markdown',
]);