-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.py
76 lines (65 loc) · 2.14 KB
/
run.py
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
from bot import InstagramBot
from user import user, pwrd
def rec_n_check():
"""
record followers and following then check for non-followbackers to unfollow
> if there are accounts to follow a prompt (with details) will ask how many to unfollow
>> range: 0-24
methods used:
> record_followers_and_following (helpers.py)
> check_non_followbackers (helpers.py)
"""
ig = InstagramBot(username=user)
# make record & return file path
record = ig.record_followers_and_following(user=user, pwrd=pwrd, account=user)
# check that record (file path) & return list of non-followbackers
check = ig.check_non_followbackers(ref=record)
# unfollow given accounts from that list
run = ig.unfollow(pwrd=pwrd, accounts_to_unfollow=check)
# record then check followbackers (display output)
print(run)
def add_hashtags(post, comment):
"""
add hashtags (as a comment) to a given post
methods used:
> login
> comment
> close_browser
"""
# tag bot instance
ig = InstagramBot(username=user)
# log in
ig.login(password=pwrd)
# comment (display output)
print(ig.comment(post, comment))
# close up shop
ig.shutdown()
# give us the final status
return ig.final_output
def like_by_hashtag(hashtags, scroll_range=5, indicator_thresh=5, limit=50):
"""
identify then like posts from given hashtags
methods used:
> login
> gather_posts
> like_posts
> close_browser
"""
# tag bot instance
ig = InstagramBot(username=user)
# log in
ig.login(password=pwrd)
# go through hashtags
for tag in hashtags:
# gather posts (apply inputs to corresponding method params)
to_like = ig.gather_posts(hashtag=tag, scroll_range=scroll_range, limit=limit)
# like posts
ig.like_posts(hashtag=tag, hrefs=to_like, indicator_thresh=indicator_thresh)
# close up shop
ig.shutdown()
# give us the final status
return ig.final_output
# make this a runable script
if __name__ == "__main__":
# tbd
print('nothing here just yet.. ideas?')