Likes some amounts of images for each usernames
(
self,
usernames: list,
amount: int = 10,
randomize: bool = False,
media: str = None,
)
| 2415 | return self |
| 2416 | |
| 2417 | def interact_by_users( |
| 2418 | self, |
| 2419 | usernames: list, |
| 2420 | amount: int = 10, |
| 2421 | randomize: bool = False, |
| 2422 | media: str = None, |
| 2423 | ): |
| 2424 | """Likes some amounts of images for each usernames""" |
| 2425 | if self.aborting: |
| 2426 | return self |
| 2427 | |
| 2428 | message = "Starting to interact by users.." |
| 2429 | highlight_print(self.username, message, "feature", "info", self.logger) |
| 2430 | |
| 2431 | if not isinstance(usernames, list): |
| 2432 | usernames = [usernames] |
| 2433 | |
| 2434 | # standalone means this feature is started by the user |
| 2435 | standalone = ( |
| 2436 | True if "interact_by_users" not in self.internal_usage.keys() else False |
| 2437 | ) |
| 2438 | # skip validation in case of it is already accomplished |
| 2439 | users_validated = ( |
| 2440 | True |
| 2441 | if not standalone |
| 2442 | and not self.internal_usage["interact_by_users"]["validate"] |
| 2443 | else False |
| 2444 | ) |
| 2445 | |
| 2446 | total_liked_img = 0 |
| 2447 | already_liked = 0 |
| 2448 | inap_img = 0 |
| 2449 | commented = 0 |
| 2450 | followed = 0 |
| 2451 | already_followed = 0 |
| 2452 | not_valid_users = 0 |
| 2453 | |
| 2454 | self.quotient_breach = False |
| 2455 | |
| 2456 | for index, username in enumerate(usernames): |
| 2457 | if self.quotient_breach: |
| 2458 | # keep `quotient_breach` active to break the internal |
| 2459 | # iterators of the caller |
| 2460 | self.quotient_breach = True if not standalone else False |
| 2461 | break |
| 2462 | |
| 2463 | self.logger.info("Username [{}/{}]".format(index + 1, len(usernames))) |
| 2464 | self.logger.info("--> {}".format(username.encode("utf-8"))) |
| 2465 | |
| 2466 | if not users_validated: |
| 2467 | validation, details = self.validate_user_call(username) |
| 2468 | if not validation: |
| 2469 | self.logger.info("--> not a valid user: {}".format(details)) |
| 2470 | not_valid_users += 1 |
| 2471 | continue |
| 2472 | |
| 2473 | track = "profile" |
| 2474 | # decision making |
no test coverage detected