Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
total_liked_img = 0
already_liked = 0
inap_img = 0
commented = 0
followed = 0
usernames = usernames or []
for index, username in enumerate(usernames):
print('Username [{}/{}]'.format(index +1, len(usernames)))
print('--> {}'.format(username.encode('utf-8')))
self.logFile.write('Username [{}/[]]'.format(index + 1, len(usernames)))
self.logFile.write('--> {}\n'.format(username.encode('utf-8')))
following = randint(0, 100) <= self.follow_percentage
try:
links = get_links_for_username(self.browser, username, amount, random, media)
except NoSuchElementException:
print('Element not found, skipping this username')
self.logFile.write('Element not found, skipping this username\n')
continue
if self.do_follow and username not in self.dont_include \
and following \
and self.follow_restrict.get(username, 0) < self.follow_times:
followed += follow_user(self.browser, self.follow_restrict, self.username, username)
else:
print('--> Not following')
sleep(1)
if links == False:
continue
self.ignore_users,
self.blacklist,
self.potency_ratio,
self.delimit_by_numbers,
self.max_followers,
self.max_following,
self.min_followers,
self.min_following,
self.logger)
if validation != True:
self.logger.info(details)
not_valid_users += 1
continue
try:
links = get_links_for_username(
self.browser,
username,
amount,
self.logger,
randomize,
media)
except NoSuchElementException:
self.logger.error('Element not found, skipping this username')
continue
if (self.do_follow and
username not in self.dont_include and
following and
self.follow_restrict.get(username, 0) < self.follow_times):
followed += follow_user(self.browser,
self.follow_restrict,
self.ignore_users,
self.blacklist,
self.potency_ratio,
self.delimit_by_numbers,
self.max_followers,
self.max_following,
self.min_followers,
self.min_following,
self.logger)
if validation != True:
self.logger.info(details)
not_valid_users += 1
continue
try:
links = get_links_for_username(self.browser,
username,
amount,
self.logger,
randomize,
media)
except NoSuchElementException:
self.logger.error('Element not found, skipping this username')
continue
if links is False:
continue
# Reset like counter for every username
liked_img = 0
# Will we follow this user?