From 21960f24047bdf64eff99ec955ff2229c49eff50 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 25 Dec 2018 19:28:32 +0000 Subject: Add support for using forum profile pictures --- app/tasks/phpbbparser.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'app/tasks/phpbbparser.py') diff --git a/app/tasks/phpbbparser.py b/app/tasks/phpbbparser.py index 9984ad0..d3e1231 100644 --- a/app/tasks/phpbbparser.py +++ b/app/tasks/phpbbparser.py @@ -15,8 +15,9 @@ def urlEncodeNonAscii(b): class Profile: def __init__(self, username): - self.username = username - self.signature = "" + self.username = username + self.signature = "" + self.avatar = None self.properties = {} def set(self, key, value): @@ -33,6 +34,11 @@ def __extract_properties(profile, soup): if el is None: return None + res1 = el.find_all("dl") + imgs = res1[0].find_all("img") + if len(imgs) == 1: + profile.avatar = imgs[0]["src"] + res = el.find_all("dl", class_ = "left-box details") if len(res) != 1: return None -- cgit v1.2.3