Improve account search

This commit is contained in:
Wire 2020-07-14 19:00:50 +02:00
parent e76e74160a
commit 62003cb39d
3 changed files with 7 additions and 9 deletions

View File

@ -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))
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)

View File

@ -6,7 +6,7 @@
<img class="ui avatar image" src="{{ url_for('static',filename='img/avatars/')}}{{range(1, 12) | random}}.png">
</div>
</div>
<div class="header" id="author"><a href="/{{post.op.replace('@','')}}">{{ post.op }}</a></div>
<div class="header" id="author"><a href="user/{{post.op.replace('@','')}}">{{ post.op }}</a></div>
<div class="meta">
<span class="category" id="time"><i class="clock icon"></i> {{post.date}} </span>
<span class="category"><i class="retweet icon"></i> {{post.username}} retwitted</span>

View File

@ -6,7 +6,7 @@
<img class="ui avatar image" src="{{ post.profilePic }}">
</div>
</div>
<div class="header" id="author"><a href="/{{post.op.replace('@','')}}">{{ post.op }}</a></div>
<div class="header" id="author"><a href="user/{{post.op.replace('@','')}}">{{ post.op }}</a></div>
<div class="meta">
<span class="category" id="time"><i class="clock icon"></i> {{post.date}} </span>
{% if post.isPinned %}