From 62003cb39d4e676e55021bf024f2368bb5fddef7 Mon Sep 17 00:00:00 2001 From: Wire Date: Tue, 14 Jul 2020 19:00:50 +0200 Subject: [PATCH] Improve account search --- app/routes.py | 12 +++++------- app/templates/_post.html | 2 +- app/templates/_post_nort.html | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/routes.py b/app/routes.py index 93816a8..b80fd6a 100644 --- a/app/routes.py +++ b/app/routes.py @@ -163,16 +163,14 @@ def search(): parsedResults = [] if form.validate_on_submit(): user = form.username.data - if isTwitterUser(user): - r = requests.get("{instance}search?f=users&q={usern}".format(instance=nitterInstance, usern=user)) - html = BeautifulSoup(str(r.content), "lxml") - results = html.body.find_all('a', attrs={'class':'tweet-link'}) - + r = requests.get("{instance}search?f=users&q={usern}".format(instance=nitterInstance, usern=user.replace(" ", "+"))) + html = BeautifulSoup(str(r.content), "lxml") + results = html.body.find_all('a', attrs={'class':'tweet-link'}) + if results: parsedResults = [s['href'].replace("/", "") for s in results] - return render_template('search.html', form = form, results = parsedResults) else: - flash("User {} does not exist!".format(user)) + flash("User {} not found...".format(user)) return render_template('search.html', form = form, results = parsedResults) else: return render_template('search.html', form = form) diff --git a/app/templates/_post.html b/app/templates/_post.html index 21e4089..8b462df 100644 --- a/app/templates/_post.html +++ b/app/templates/_post.html @@ -6,7 +6,7 @@ -
{{ post.op }}
+
{{ post.op }}
{{post.date}} {{post.username}} retwitted diff --git a/app/templates/_post_nort.html b/app/templates/_post_nort.html index 6770461..062fc16 100644 --- a/app/templates/_post_nort.html +++ b/app/templates/_post_nort.html @@ -6,7 +6,7 @@
-
{{ post.op }}
+
{{ post.op }}
{{post.date}} {% if post.isPinned %}