|
|
|
@ -83,7 +83,8 @@ def profile_picture_reactions(profile, user, all_pictures, first_user=False, mod |
|
|
|
|
|
|
|
|
|
|
|
user.add_to_db() |
|
|
|
user.add_to_db() |
|
|
|
# Gå till profilbilden (den första som kommer upp när man går till profilen) |
|
|
|
# Gå till profilbilden (den första som kommer upp när man går till profilen) |
|
|
|
if not hasattr(user, "url_album"): |
|
|
|
|
|
|
|
|
|
|
|
if not hasattr(user, "url_album"): # Om profilen inte har profilalbum |
|
|
|
write_error(9, soup=profile.viewing(), user=user.username) |
|
|
|
write_error(9, soup=profile.viewing(), user=user.username) |
|
|
|
if user.url_other_picture != '': |
|
|
|
if user.url_other_picture != '': |
|
|
|
# Använd eventuell extrabild och ta bort den från användaren |
|
|
|
# Använd eventuell extrabild och ta bort den från användaren |
|
|
|
@ -100,7 +101,7 @@ def profile_picture_reactions(profile, user, all_pictures, first_user=False, mod |
|
|
|
return None |
|
|
|
return None |
|
|
|
# ATT GÖRA Här kan andra bilder väljas istället |
|
|
|
# ATT GÖRA Här kan andra bilder väljas istället |
|
|
|
|
|
|
|
|
|
|
|
else: |
|
|
|
else: # Normalfallet där användaren har profilbildsalbum |
|
|
|
profile.browser.open(user.url_album) |
|
|
|
profile.browser.open(user.url_album) |
|
|
|
|
|
|
|
|
|
|
|
# Samla alla profilbilder i en lista |
|
|
|
# Samla alla profilbilder i en lista |
|
|
|
@ -129,7 +130,7 @@ def profile_picture_reactions(profile, user, all_pictures, first_user=False, mod |
|
|
|
url_pics = url_pics[:1] |
|
|
|
url_pics = url_pics[:1] |
|
|
|
elif mode == 'few' and len(url_pics) > 1: |
|
|
|
elif mode == 'few' and len(url_pics) > 1: |
|
|
|
url_pics = url_pics[:1] + url_pics[-1:] |
|
|
|
url_pics = url_pics[:1] + url_pics[-1:] |
|
|
|
|
|
|
|
|
|
|
|
# Gå igenom valda bilder. |
|
|
|
# Gå igenom valda bilder. |
|
|
|
for pic in url_pics: |
|
|
|
for pic in url_pics: |
|
|
|
# Skriv ut vilken bild som behandlas. |
|
|
|
# Skriv ut vilken bild som behandlas. |
|
|
|
@ -142,8 +143,8 @@ def profile_picture_reactions(profile, user, all_pictures, first_user=False, mod |
|
|
|
picture.id = str(re.search('\d+', picture.id).group()) |
|
|
|
picture.id = str(re.search('\d+', picture.id).group()) |
|
|
|
except: |
|
|
|
except: |
|
|
|
pass |
|
|
|
pass |
|
|
|
if picture.id in all_pictures: |
|
|
|
# if picture.id in all_pictures: |
|
|
|
continue |
|
|
|
# continue |
|
|
|
sleep_(5) |
|
|
|
sleep_(5) |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
@ -184,11 +185,11 @@ def profile_picture_reactions(profile, user, all_pictures, first_user=False, mod |
|
|
|
picture.url_full = pic[ |
|
|
|
picture.url_full = pic[ |
|
|
|
: pic.find("&") |
|
|
|
: pic.find("&") |
|
|
|
] # Den fullständiga adressen till bilden, används som _key i pictures |
|
|
|
] # Den fullständiga adressen till bilden, används som _key i pictures |
|
|
|
if 'url_reactions' not in globals(): |
|
|
|
if 'url_reactions' not in locals(): |
|
|
|
for a in profile.viewing().find_all("a", href=True): |
|
|
|
for a in profile.viewing().find_all("a", href=True): |
|
|
|
if '/likes/' in a["href"]: |
|
|
|
if '/likes/' in a["href"]: |
|
|
|
url_reactions = url_bas + str(a["href"]) |
|
|
|
url_reactions = url_bas + str(a["href"]) |
|
|
|
if 'url_reactions' not in globals(): |
|
|
|
if 'url_reactions' not in locals(): |
|
|
|
for div in profile.viewing().find_all("div", href=True): |
|
|
|
for div in profile.viewing().find_all("div", href=True): |
|
|
|
if 'like this' in div.text: |
|
|
|
if 'like this' in div.text: |
|
|
|
url_reactions = url_bas + str(div["href"]) |
|
|
|
url_reactions = url_bas + str(div["href"]) |
|
|
|
|