-
Notifications
You must be signed in to change notification settings - Fork 6
/
timeline_feed_comment_liker.php
77 lines (74 loc) · 3.41 KB
/
timeline_feed_comment_liker.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
<?php
require __DIR__."/vendor/autoload.php";
require __DIR__."/config.php";
$instagram = new \InstagramAPI\Instagram(false, false);
$signature = \InstagramAPI\Signatures::generateUUID();
try
{
echo("[?] Try for login as {$account['username']}...\n");
$instagram->login($account['username'], $account['password']);
echo("[!] Login successfully!\n");
sleep(2);
echo("[!] Getting timeline feeds...\n");
$next_max_id = null;
$liked = 0;
do
{
$feeds = $instagram->timeline->getTimelineFeed($next_max_id);
foreach($feeds->getFeedItems() as $feed)
{
if($feed->isMediaOrAd() == 1)
{
if($feed->getMediaOrAd()->isId() && empty($feed->getMediaOrAd()->isHasLiked()))
{
if($timeline_feed_comment_liker['is_likes'] == 1)
{
$like = $instagram->media->like($feed->getMediaOrAd()->getId());
if($like->getStatus() == "ok")
{
echo "[+] ".date("d-m-Y H:i:s")." on ".$feed->getMediaOrAd()->getUser()->getUsername()."'s feed was liked.\n";
}
else
{
echo "[!] ".date("d-m-Y H:i:s")." on have a error, please wait for next job in {$timeline_feed_comment_liker['have_err']} seconds.\n";
sleep($timeline_feed_comment_liker['have_err']);
}
}
if($instagram->media->getComments($feed->getMediaOrAd()->getId())->isComments())
{
$comments = $instagram->media->getComments($feed->getMediaOrAd()->getId())->getComments();
for($i = 0; $i < $instagram->media->getComments($feed->getMediaOrAd()->getId())->getCommentCount(); $i++)
{
if($timeline_feed_comment_liker['max_like'] === $liked)
{
$liked = 0;
break;
}
if($comments[$i]->isPk() && empty($comments[$i]->isHasLikedComment()))
{
$like = $instagram->media->likeComment($comments[$i]->getPk());
if($like->getStatus() == "ok")
{
echo "[+] ".date("d-m-Y H:i:s")." on ".$feed->getMediaOrAd()->getUser()->getUsername()."'s feed in ".$comments[$i]->getUser()->getUsername()." user comment was liked.\n";
sleep($timeline_feed_comment_liker['interval']);
$liked++;
}
else
{
echo "[!] ".date("d-m-Y H:i:s")." on have a error, please wait for next job in {$timeline_feed_comment_liker['have_err']} seconds.\n";
sleep($timeline_feed_comment_liker['have_err']);
}
}
}
}
}
}
}
$next_max_id = $feeds->getNextMaxId();
}
while($next_max_id !== null);
}
catch(Exception $e)
{
echo("[!] ".$e->getMessage()."\n");
}