diff options
author | rubenwardy <rw@rubenwardy.com> | 2020-07-10 18:41:08 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2020-07-10 18:41:08 +0100 |
commit | 491f9ed6796b1aa34437f3247cb8956c928b1143 (patch) | |
tree | 3f67a5d5c1857f820959706c3249eaf0033884ab /app/tasks/phpbbparser.py | |
parent | 000259fc8875e8577500d4e60ba3c5b5898f56d8 (diff) | |
download | cheatdb-491f9ed6796b1aa34437f3247cb8956c928b1143.tar.xz |
Fix GitHub claim method being broken by phpBB update
Diffstat (limited to 'app/tasks/phpbbparser.py')
-rw-r--r-- | app/tasks/phpbbparser.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/tasks/phpbbparser.py b/app/tasks/phpbbparser.py index 752c7a6..caaa730 100644 --- a/app/tasks/phpbbparser.py +++ b/app/tasks/phpbbparser.py @@ -21,10 +21,10 @@ class Profile: self.properties = {} def set(self, key, value): - self.properties[key] = value + self.properties[key.lower()] = value def get(self, key): - return self.properties[key] if key in self.properties else None + return self.properties.get(key.lower()) def __str__(self): return self.username + "\n" + str(self.signature) + "\n" + str(self.properties) @@ -39,7 +39,7 @@ def __extract_properties(profile, soup): if len(imgs) == 1: profile.avatar = imgs[0]["src"] - res = el.find_all("dl", class_ = "left-box details") + res = el.select("dl.left-box.details") if len(res) != 1: return None @@ -85,12 +85,12 @@ def getProfile(url, username): soup = BeautifulSoup(contents, "lxml") if soup is None: return None - else: - profile = Profile(username) - profile.signature = __extract_signature(soup) - __extract_properties(profile, soup) - return profile + profile = Profile(username) + profile.signature = __extract_signature(soup) + __extract_properties(profile, soup) + + return profile regex_id = re.compile(r"^.*t=([0-9]+).*$") |