23
23
parser .add_argument ('-p' , '--password' , help = 'instagram password' )
24
24
parser .add_argument ('-l' , '--likes' , type = int , default = 600 , help = 'likes per day' )
25
25
parser .add_argument ('-min' , '--minlikes' , type = int , default = 24 , help = 'min likes per tag round' )
26
- parser .add_argument ('-max' , '--maxlikes' , type = int , default = 79 , help = 'max likes per tag round' )
26
+ parser .add_argument ('-max' , '--maxlikes' , type = int , default = 44 , help = 'max likes per tag round' )
27
27
parser .add_argument ('-ht' , '--hashtags' , nargs = '+' , default = ["l4l" , "f4f" ], help = 'hashtags to like' )
28
28
parser .add_argument ('-bl' , '--blacklist' , nargs = '+' , default = ["sex" , "nsfw" ], help = 'blacklist hashtags' )
29
29
parser .add_argument ('-v' , '--version' , action = 'version' , version = '%(prog)s 0.1' )
@@ -33,6 +33,7 @@ def cleanup(): #logout and exit when CTRL + C is pressed
33
33
InstagramAPI .logout ()
34
34
print ('\n \n ' )
35
35
print ('Start time: {}' .format (start_time ))
36
+ print ('End time: {}' .format (datetime .now ().strftime ('%A, %d. %B %Y %I:%M%p' )))
36
37
print ('Total likes: {}' .format (total_like ))
37
38
print ('\n \n ' )
38
39
@@ -106,9 +107,11 @@ def cleanup(): #logout and exit when CTRL + C is pressed
106
107
time .sleep (random .randint (2 ,4 ))
107
108
108
109
media_id = InstagramAPI .LastJson
110
+ if max_likes_per_tag > len (media_id ['items' ]): #check hashtag picture count
111
+ max_likes_per_tag = (len (media_id )['items' ])
109
112
110
113
likes_per_tag = random .randint (min_likes_per_tag ,max_likes_per_tag )
111
- for element in media_id ['items' ][:likes_per_tag ]:
114
+ for element in media_id ['items' ][:likes_per_tag + 1 ]:
112
115
like = True
113
116
if 'caption' in element :
114
117
for hashtag in re .split (r'#|\s' , element ['caption' ]['text' ]): #blacklist
0 commit comments