Improve account search
This commit is contained in:
parent
e76e74160a
commit
62003cb39d
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -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 %}
|
||||
|
Reference in New Issue
Block a user