|
|
|
|
@ -8,13 +8,17 @@ from helpers import sleep_, update_cookie, write_error, _print |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def profile_picture_reactions( |
|
|
|
|
profile, user, all_pictures, first_user=False, mode="all" |
|
|
|
|
profile, user, first_user=False, mode="all" |
|
|
|
|
): |
|
|
|
|
#try: |
|
|
|
|
|
|
|
|
|
# Fixa url:er osv |
|
|
|
|
|
|
|
|
|
if user.username.isnumeric(): |
|
|
|
|
user.url = url_bas + "/profile.php?id=" + str(user.username) |
|
|
|
|
user.url_photos = user.url + "&v=photos" |
|
|
|
|
user.id = user.username |
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
user.username = user.username.replace("/", "") |
|
|
|
|
user.url = url_bas + "/" + user.username |
|
|
|
|
@ -22,18 +26,21 @@ def profile_picture_reactions( |
|
|
|
|
|
|
|
|
|
# Gå till sidan för profilbilder |
|
|
|
|
profile.browser.open(user.url_photos) |
|
|
|
|
#print(profile.viewing()) |
|
|
|
|
sleep_(4) |
|
|
|
|
|
|
|
|
|
if """You can't use Facebook because your account, or activity on it, doesn't follow our Community Standards.""" in profile.viewing(): |
|
|
|
|
if "Your Account Has Been Disabled." in profile.viewing(): |
|
|
|
|
_print(profile, user, f"{profile.name} blocked\n".upper(), sleeptime=1) |
|
|
|
|
profile.blocked = True |
|
|
|
|
return profile |
|
|
|
|
elif 'It looks like you were misusing this feature by going too fast.' in profile.viewing().text: |
|
|
|
|
sleep_(600) |
|
|
|
|
profile.blocked = True # Nu tar jag bort dem, kan göras på annat sätt kanske? |
|
|
|
|
return profile |
|
|
|
|
elif "accept all" in profile.viewing().text.lower(): |
|
|
|
|
profile.accept_cookies() |
|
|
|
|
profile.browser.open(user.url_photos) |
|
|
|
|
elif profile.viewing().find('title').text.strip() == 'Log in to Facebook | Facebook': |
|
|
|
|
sleep_(5) |
|
|
|
|
profile.login() |
|
|
|
|
sleep_(5) |
|
|
|
|
profile.browser.open(user.url_photos) |
|
|
|
|
@ -48,9 +55,9 @@ def profile_picture_reactions( |
|
|
|
|
except Exception as e: |
|
|
|
|
write_error( |
|
|
|
|
6, |
|
|
|
|
profile, |
|
|
|
|
e=e, |
|
|
|
|
traceback=traceback.format_exc(), |
|
|
|
|
profile=profile, |
|
|
|
|
soup=profile.viewing(), |
|
|
|
|
user=user, |
|
|
|
|
url=user.url_photos, |
|
|
|
|
@ -95,7 +102,7 @@ def profile_picture_reactions( |
|
|
|
|
|
|
|
|
|
# Om profilen inte har profilalbum |
|
|
|
|
if not hasattr(user, "url_album"): |
|
|
|
|
write_error(9, soup=profile.viewing(), user=user, profile=profile) |
|
|
|
|
write_error(9, profile, soup=profile.viewing(), user=user) |
|
|
|
|
if user.url_other_pictures != []: |
|
|
|
|
# Använd eventuella extrabilder och ta bort den från användaren |
|
|
|
|
url_pics = user.url_other_pictures |
|
|
|
|
@ -109,8 +116,8 @@ def profile_picture_reactions( |
|
|
|
|
_print(profile, user, "Hittar inget album för profilbilder.") |
|
|
|
|
write_error(#fel7 |
|
|
|
|
7, |
|
|
|
|
profile, |
|
|
|
|
soup=profile.viewing(), |
|
|
|
|
profile=profile, |
|
|
|
|
user=user, |
|
|
|
|
url=user.url_album, |
|
|
|
|
url_name="user.url_album", |
|
|
|
|
@ -164,7 +171,7 @@ def profile_picture_reactions( |
|
|
|
|
return profile |
|
|
|
|
|
|
|
|
|
# except Exception as e: |
|
|
|
|
# _print(profile, None, str(e)) |
|
|
|
|
# _print(None, str(e)) |
|
|
|
|
# return profile |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -187,8 +194,8 @@ def check_picture(url_picture, user, profile): |
|
|
|
|
except Exception as e: # Fel3 |
|
|
|
|
write_error( |
|
|
|
|
3, |
|
|
|
|
profile, |
|
|
|
|
e=e, |
|
|
|
|
profile=profile, |
|
|
|
|
soup=profile.viewing(), |
|
|
|
|
user=user, |
|
|
|
|
url=picture.url, |
|
|
|
|
@ -196,7 +203,7 @@ def check_picture(url_picture, user, profile): |
|
|
|
|
traceback=traceback.format_exc(), |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
update_cookie(profile.browser.session.cookies, profile.name) |
|
|
|
|
update_cookie(profile.browser.session.cookies, profile) |
|
|
|
|
|
|
|
|
|
# Hitta info om bilden |
|
|
|
|
try: |
|
|
|
|
@ -246,7 +253,7 @@ def check_picture(url_picture, user, profile): |
|
|
|
|
|
|
|
|
|
profile.browser.open(url_reactions) |
|
|
|
|
|
|
|
|
|
update_cookie(profile.browser.session.cookies, profile.name) |
|
|
|
|
update_cookie(profile.browser.session.cookies, profile) |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
for a in profile.viewing().find_all("a", {"class": "z ba"}, href=True): |
|
|
|
|
@ -259,8 +266,8 @@ def check_picture(url_picture, user, profile): |
|
|
|
|
except UnboundLocalError: # fel9 |
|
|
|
|
write_error( |
|
|
|
|
9, |
|
|
|
|
profile, |
|
|
|
|
user=user, |
|
|
|
|
profile=profile, |
|
|
|
|
soup=profile.viewing(), |
|
|
|
|
traceback=traceback.format_exc(), |
|
|
|
|
url=url_reactions, |
|
|
|
|
@ -280,7 +287,7 @@ def check_picture(url_picture, user, profile): |
|
|
|
|
sleep_(4) |
|
|
|
|
profile.browser.open(url_limit) |
|
|
|
|
url_limit = "" |
|
|
|
|
update_cookie(profile.browser.session.cookies, profile.name) |
|
|
|
|
update_cookie(profile.browser.session.cookies, profile) |
|
|
|
|
|
|
|
|
|
# Gå igenom alla som reagerat och för in i arango |
|
|
|
|
for li in profile.viewing().find_all("li"): |
|
|
|
|
@ -307,10 +314,10 @@ def check_picture(url_picture, user, profile): |
|
|
|
|
except AttributeError as e: # Fel1 |
|
|
|
|
write_error( |
|
|
|
|
1, |
|
|
|
|
profile, |
|
|
|
|
e=e, |
|
|
|
|
soup=str(li), |
|
|
|
|
user=user, |
|
|
|
|
profile=profile, |
|
|
|
|
traceback=traceback.format_exc(), |
|
|
|
|
) |
|
|
|
|
pass |
|
|
|
|
@ -328,9 +335,9 @@ def check_picture(url_picture, user, profile): |
|
|
|
|
except Exception as e: # Fel2 |
|
|
|
|
write_error( |
|
|
|
|
2, |
|
|
|
|
profile, |
|
|
|
|
e=e, |
|
|
|
|
soup=profile.viewing(), |
|
|
|
|
profile=profile, |
|
|
|
|
user=user, |
|
|
|
|
url=url_limit, |
|
|
|
|
url_name="url_limit", |
|
|
|
|
|