|
|
|
|
@ -93,93 +93,96 @@ if __name__ == "__main__": |
|
|
|
|
print("Börjar med profilen", profile.name) |
|
|
|
|
|
|
|
|
|
# Gå igenom de användare som efterfrågats |
|
|
|
|
while True: |
|
|
|
|
for user in users: |
|
|
|
|
# Set för kollade bilder och kollade medlemmar |
|
|
|
|
all_pictures = set([doc["_key"] for doc in db.collection("pictures").all()]) |
|
|
|
|
all_pictures_start = all_pictures.copy() |
|
|
|
|
members_checked = arangodb.checked_members() |
|
|
|
|
|
|
|
|
|
if user.username not in members_checked:# Hämta reaktioner för den första användaren LÄGG TILL NOT IN MEMBERS_CHECKED |
|
|
|
|
try: |
|
|
|
|
profile_picture_reactions(profile, user, all_pictures, first_user=True, mode=mode) |
|
|
|
|
except: |
|
|
|
|
print(traceback.format_exc()) |
|
|
|
|
if len(users) == 1: |
|
|
|
|
for profile in profiles: |
|
|
|
|
profile.unused() |
|
|
|
|
friends = arangodb.friends_of_user(user.username) |
|
|
|
|
friends_unchecked = list(set(friends) - set(members_checked)) |
|
|
|
|
# Här följer cookien med så att vi fortfarnade är inloggade |
|
|
|
|
print("\nKlar med", user.username, "\n") |
|
|
|
|
|
|
|
|
|
print("Vänner som reagerat:", len(friends)) |
|
|
|
|
print("Vänner att kolla:") |
|
|
|
|
|
|
|
|
|
for friend in friends_unchecked: |
|
|
|
|
print(friend) |
|
|
|
|
print() |
|
|
|
|
|
|
|
|
|
# Hämta reaktioner för users vänner (som reagerat) |
|
|
|
|
count_friends = 0 |
|
|
|
|
for friend in friends_unchecked: |
|
|
|
|
count_friends += 1 |
|
|
|
|
user = User(str(friend)) |
|
|
|
|
sleep_(2) |
|
|
|
|
try: |
|
|
|
|
profile_picture_reactions( |
|
|
|
|
profile, user, all_pictures, mode=mode |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
if profile.blocked == True: |
|
|
|
|
# Ta bort profilen ur databasen |
|
|
|
|
arangodb.remove_profile(profile.doc["_key"]) |
|
|
|
|
# Ta bort från listan på fb-profiler som används |
|
|
|
|
profiles.remove(profile) |
|
|
|
|
# Försök lägga till en ny fb-profil (om det finns en skapad och ledig i databasen) |
|
|
|
|
try: |
|
|
|
|
profiles[profile_nr] = Profile(new=True) |
|
|
|
|
print("Laddat ny profil:", profiles[profile_nr].name) |
|
|
|
|
sleep(3) |
|
|
|
|
except e: |
|
|
|
|
print("Det behövs nya profiler...") |
|
|
|
|
for s in range(0, 1600 / len(profiles)): |
|
|
|
|
print(f"Sover {600-s} sekunder till... ", end="\r") |
|
|
|
|
profile_nr += 1 |
|
|
|
|
print(f"Försöker med {profiles[profile_nr].name}.") |
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
print("Klar med", user.username, "\n") |
|
|
|
|
|
|
|
|
|
# Rotera fb-profiler |
|
|
|
|
if count_friends > 5 * mode_nr: |
|
|
|
|
if random.randrange(0, 2, 1) == 1: |
|
|
|
|
try: |
|
|
|
|
while True: |
|
|
|
|
for user in users: |
|
|
|
|
# Set för kollade bilder och kollade medlemmar |
|
|
|
|
all_pictures = set([doc["_key"] for doc in db.collection("pictures").all()]) |
|
|
|
|
all_pictures_start = all_pictures.copy() |
|
|
|
|
members_checked = arangodb.checked_members() |
|
|
|
|
|
|
|
|
|
if user.username not in members_checked:# Hämta reaktioner för den första användaren LÄGG TILL NOT IN MEMBERS_CHECKED |
|
|
|
|
try: |
|
|
|
|
profile_picture_reactions(profile, user, all_pictures, first_user=True, mode=mode) |
|
|
|
|
except: |
|
|
|
|
print(traceback.format_exc()) |
|
|
|
|
if len(users) == 1: |
|
|
|
|
for profile in profiles: |
|
|
|
|
profile.unused() |
|
|
|
|
friends = arangodb.friends_of_user(user.username) |
|
|
|
|
friends_unchecked = list(set(friends) - set(members_checked)) |
|
|
|
|
# Här följer cookien med så att vi fortfarnade är inloggade |
|
|
|
|
print("\nKlar med", user.username, "\n") |
|
|
|
|
|
|
|
|
|
print("Vänner som reagerat:", len(friends)) |
|
|
|
|
print("Vänner att kolla:") |
|
|
|
|
|
|
|
|
|
for friend in friends_unchecked: |
|
|
|
|
print(friend) |
|
|
|
|
print() |
|
|
|
|
|
|
|
|
|
# Hämta reaktioner för users vänner (som reagerat) |
|
|
|
|
count_friends = 0 |
|
|
|
|
for friend in friends_unchecked: |
|
|
|
|
count_friends += 1 |
|
|
|
|
user = User(str(friend)) |
|
|
|
|
sleep_(2) |
|
|
|
|
try: |
|
|
|
|
profile_picture_reactions( |
|
|
|
|
profile, user, all_pictures, mode=mode |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
if profile.blocked == True: |
|
|
|
|
# Ta bort profilen ur databasen |
|
|
|
|
arangodb.remove_profile(profile.doc["_key"]) |
|
|
|
|
# Ta bort från listan på fb-profiler som används |
|
|
|
|
profiles.remove(profile) |
|
|
|
|
# Försök lägga till en ny fb-profil (om det finns en skapad och ledig i databasen) |
|
|
|
|
try: |
|
|
|
|
profiles[profile_nr] = Profile(new=True) |
|
|
|
|
print("Laddat ny profil:", profiles[profile_nr].name) |
|
|
|
|
sleep(3) |
|
|
|
|
except e: |
|
|
|
|
print("Det behövs nya profiler...") |
|
|
|
|
for s in range(0, 1600 / len(profiles)): |
|
|
|
|
print(f"Sover {600-s} sekunder till... ", end="\r") |
|
|
|
|
profile_nr += 1 |
|
|
|
|
print(f"Försöker med {profiles[profile_nr].name}.") |
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
print("Klar med", user.username, "\n") |
|
|
|
|
|
|
|
|
|
# Rotera fb-profiler |
|
|
|
|
if count_friends > 5 * mode_nr: |
|
|
|
|
if random.randrange(0, 2, 1) == 1: |
|
|
|
|
profile_nr += 1 |
|
|
|
|
count_friends = 0 |
|
|
|
|
print("Växlar till", profiles[profile_nr].name) |
|
|
|
|
elif count_friends > 9 * mode_nr: |
|
|
|
|
profile_nr += 1 |
|
|
|
|
count_friends = 0 |
|
|
|
|
print("Växlar till", profiles[profile_nr].name) |
|
|
|
|
elif count_friends > 9 * mode_nr: |
|
|
|
|
profile_nr += 1 |
|
|
|
|
count_friends = 0 |
|
|
|
|
print("Växlar till", profiles[profile_nr].name) |
|
|
|
|
|
|
|
|
|
if profile_nr > len(profiles) - 1: |
|
|
|
|
profile_nr = 0 |
|
|
|
|
profile = profiles[profile_nr] |
|
|
|
|
|
|
|
|
|
except Exception as e: # Fel4 |
|
|
|
|
write_error( |
|
|
|
|
4, |
|
|
|
|
e=e, |
|
|
|
|
user=user.username, |
|
|
|
|
traceback=traceback.format_exc(), |
|
|
|
|
soup=profile.viewing(), |
|
|
|
|
) |
|
|
|
|
print("\nFel: ", str(user.username), "\n") |
|
|
|
|
sleep_(15) |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
# Ladda in nya användare att kolla |
|
|
|
|
for profile in profiles: |
|
|
|
|
profile.unused() |
|
|
|
|
write_report(users, list(all_pictures.difference(all_pictures_start))) |
|
|
|
|
exit() |
|
|
|
|
|
|
|
|
|
if profile_nr > len(profiles) - 1: |
|
|
|
|
profile_nr = 0 |
|
|
|
|
profile = profiles[profile_nr] |
|
|
|
|
|
|
|
|
|
except Exception as e: # Fel4 |
|
|
|
|
write_error( |
|
|
|
|
4, |
|
|
|
|
e=e, |
|
|
|
|
user=user.username, |
|
|
|
|
traceback=traceback.format_exc(), |
|
|
|
|
soup=profile.viewing(), |
|
|
|
|
) |
|
|
|
|
print("\nFel: ", str(user.username), "\n") |
|
|
|
|
sleep_(15) |
|
|
|
|
pass |
|
|
|
|
except: |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
# Gör profilerna oanvända |
|
|
|
|
for profile in profiles: |
|
|
|
|
profile.unused() |
|
|
|
|
write_report(users, list(all_pictures.difference(all_pictures_start))) |
|
|
|
|
exit() |