aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2018-11-04 22:31:53 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2018-11-04 22:31:53 +0100
commita375c99d1df9b80a8a1bfe778785e6f8649a0cdc (patch)
treef6cc8d1558835f0d570a6a15ebda2c8adbca621d /src
parentRemoved now useless stop words lists. (diff)
parentOffers more filtering possibilities on the popular feeds view for the user (diff)
downloadnewspipe-a375c99d1df9b80a8a1bfe778785e6f8649a0cdc.tar.gz
newspipe-a375c99d1df9b80a8a1bfe778785e6f8649a0cdc.tar.bz2
newspipe-a375c99d1df9b80a8a1bfe778785e6f8649a0cdc.zip
Merge branch 'master' of gitlab.com:newspipe/newspipe
Diffstat (limited to 'src')
-rw-r--r--src/web/templates/popular.html35
-rw-r--r--src/web/views/views.py6
2 files changed, 27 insertions, 14 deletions
diff --git a/src/web/templates/popular.html b/src/web/templates/popular.html
index aae50a8c..4b207903 100644
--- a/src/web/templates/popular.html
+++ b/src/web/templates/popular.html
@@ -1,18 +1,27 @@
{% extends "layout.html" %}
{% block content %}
<div class="container">
- <h1>{{ _('Popular feeds') }}</h1>
- <ul class="list-group">
- {% for feed in popular %}
- <li class="list-group-item">
- <a href="{{ feed[0] }}">{{ feed[0] }}</a>&nbsp;
- <a href="{{ url_for('feed.bookmarklet', url=feed[0]) }}" >
- <span class="glyphicon glyphicon-plus text-muted" title="follow this feed"></span>
- <span class="text-muted">{{ _('add this feed') }}</a>
- </a>
- <span class="badge">{{ feed[1] }}</span>
- </li>
- {% endfor %}
- </ul>
+ <div class="row">
+ <div class="col-md-12">
+ <h1>{{ _('Popular feeds') }}</h1>
+ <a href="{{ url_for('popular', nb_days='all') }}">all</a>&nbsp;&#8231;&nbsp;<a href="{{ url_for('popular', nb_days=365) }}">last year</a>&nbsp;&#8231;&nbsp;<a href="{{ url_for('popular', nb_days=31) }}">last month</a>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <ul class="list-group">
+ {% for feed in popular %}
+ <li class="list-group-item">
+ <a href="{{ feed[0] }}">{{ feed[0] }}</a>&nbsp;
+ <a href="{{ url_for('feed.bookmarklet', url=feed[0]) }}" >
+ <span class="glyphicon glyphicon-plus text-muted" title="follow this feed"></span>
+ <span class="text-muted">{{ _('add this feed') }}</span>
+ </a>
+ <span class="badge">{{ feed[1] }}</span>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ </div>
</div><!-- /.container -->
{% endblock %}
diff --git a/src/web/views/views.py b/src/web/views/views.py
index b0e8266b..57f790b1 100644
--- a/src/web/views/views.py
+++ b/src/web/views/views.py
@@ -56,7 +56,10 @@ def popular():
# try to get the 'recent' popular websites, created after
# 'not_created_before'
# ie: not_added_before = date_last_added_feed - nb_days
- nb_days = int(request.args.get('nb_days', 1000))
+ try:
+ nb_days = int(request.args.get('nb_days', 365))
+ except ValueError:
+ nb_days = 10000
last_added_feed = FeedController().read().\
order_by(desc('created_date')).limit(1).all()
if last_added_feed:
@@ -68,6 +71,7 @@ def popular():
filters = {}
filters['created_date__gt'] = not_added_before
filters['private'] = False
+ filters['error_count__lt'] = conf.DEFAULT_MAX_ERROR
feeds = FeedController().count_by_link(**filters)
sorted_feeds = sorted(list(feeds.items()), key=operator.itemgetter(1),
reverse=True)
bgstack15