Skip to content

Commit 9a38f45

Browse files
authored
caption text bug fix
fixed a bug where the bot stopped when there is no caption text
1 parent 6cdb3bf commit 9a38f45

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

instaAPI-bot.py

+3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ def cleanup(): #logout and exit when CTRL + C is pressed
109109

110110
likes_per_tag = random.randint(min_likes_per_tag,max_likes_per_tag)
111111
for element in media_id['items'][:likes_per_tag]:
112+
if not element['caption']['text']:
113+
print('No caption')
114+
continue
112115
for hashtag in re.split(r'#|\s', element['caption']['text']): #blacklist
113116
if hashtag.strip().lower() in hashtag_blacklist:
114117
print('Blacklisted hashtag "{}" found, skipping...'.format(hashtag))

0 commit comments

Comments
 (0)