|
|
|
|
@ -101,18 +101,14 @@ class Picture: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Profile: |
|
|
|
|
def __init__(self, profile, lookingup): |
|
|
|
|
def __init__(self, profile, container): |
|
|
|
|
"""Creates a new profile to do searches with. |
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
profile (dict): Document fetched from database. |
|
|
|
|
lookingup (string): Container name. |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
# Uppdatera dokumentet i arango |
|
|
|
|
self.doc = profile |
|
|
|
|
self.doc["in_use"] = nowstamp() |
|
|
|
|
db.update_document(self.doc, check_rev=False) |
|
|
|
|
|
|
|
|
|
# Användaruppgifter |
|
|
|
|
self.name = self.doc["name"].strip() |
|
|
|
|
@ -123,7 +119,7 @@ class Profile: |
|
|
|
|
self.useragent = self.doc["useragent"] |
|
|
|
|
|
|
|
|
|
self.blocked = False |
|
|
|
|
self.lookingup = lookingup |
|
|
|
|
self.container = container |
|
|
|
|
self.users_checked = 0 |
|
|
|
|
|
|
|
|
|
# Ange proxies |
|
|
|
|
@ -147,11 +143,15 @@ class Profile: |
|
|
|
|
except: |
|
|
|
|
try: |
|
|
|
|
self.browser.session.cookies.update(self.cookie) |
|
|
|
|
print(self.browser.session.cookies.values) |
|
|
|
|
self.logged_in = True |
|
|
|
|
except: |
|
|
|
|
self.logged_in = False |
|
|
|
|
|
|
|
|
|
def update_time(self): |
|
|
|
|
""" Uppdatera dokumentet i arango. """ |
|
|
|
|
self.doc["in_use"] = nowstamp() |
|
|
|
|
db.update_document(self.doc, check_rev=False) |
|
|
|
|
|
|
|
|
|
def viewing(self): |
|
|
|
|
""" Returnerar browser i html-format """ |
|
|
|
|
return self.browser.parsed |
|
|
|
|
@ -170,9 +170,12 @@ class Profile: |
|
|
|
|
self.browser.submit_form(form) |
|
|
|
|
print(f"Accepterade cookies för {self.name}") |
|
|
|
|
sleep_(2) |
|
|
|
|
update_cookie(self.browser.session.cookies, self.name) |
|
|
|
|
update_cookie(self.browser.session.cookies, self) |
|
|
|
|
except: |
|
|
|
|
write_error(12, soup=self.browser.parsed, profile=self.name) |
|
|
|
|
try: |
|
|
|
|
write_error(12, self, soup=self.browser.parsed) |
|
|
|
|
except: |
|
|
|
|
pass |
|
|
|
|
print(f"Accepterade inte cookies för {self.name}") |
|
|
|
|
|
|
|
|
|
def login(self): |
|
|
|
|
@ -197,7 +200,10 @@ class Profile: |
|
|
|
|
print("Loggade in.") |
|
|
|
|
sleep_(2) |
|
|
|
|
except TypeError: |
|
|
|
|
write_error(11, soup=soup, profile=self.name) |
|
|
|
|
try: |
|
|
|
|
write_error(11, self, soup=soup, profile=self.name) |
|
|
|
|
except: |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
def unused(self): |
|
|
|
|
""" Sätter user till False för valda profiler """ |
|
|
|
|
@ -232,7 +238,7 @@ class Friend: |
|
|
|
|
db.insert_document( |
|
|
|
|
self.collection, |
|
|
|
|
{ |
|
|
|
|
"_key": self.username, |
|
|
|
|
"_key": str(self.username), |
|
|
|
|
"url": url_bas + self.url, |
|
|
|
|
"name": self.name, |
|
|
|
|
}, |
|
|
|
|
|