From 931df1225f9dde23ee6383bbdef65f38add1dd79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?X=C3=A9fir=20Destiny?= Date: Tue, 3 Dec 2019 22:43:53 +0100 Subject: [PATCH] Finalized latest --- app.py | 20 ++++---- connectors.py | 6 +-- templates/latest.html | 103 ++++++++++++++++++++++++------------------ templates/list.html | 17 +++++++ 4 files changed, 91 insertions(+), 55 deletions(-) create mode 100644 templates/list.html diff --git a/app.py b/app.py index 8836942..645c048 100644 --- a/app.py +++ b/app.py @@ -38,29 +38,33 @@ def search(): @app.route('/latest') def latest(): + page = request.args.get('page', 1) + torrents = [ - Nyaa('', return_type=ConnectorReturn.HISTORY, page=request.args.get('page', 1)).run(), - Pantsu('', return_type=ConnectorReturn.HISTORY, page=request.args.get('page', 1)).run(), - YggTorrent('', return_type=ConnectorReturn.HISTORY, page=request.args.get('page', 1)).run(), - YggAnimation('', return_type=ConnectorReturn.HISTORY, page=request.args.get('page', 1)).run(), - AnimeUltime('', return_type=ConnectorReturn.HISTORY, page=request.args.get('page', 1)).run(), + Nyaa('', return_type=ConnectorReturn.HISTORY, page=page).run(), + Pantsu('', return_type=ConnectorReturn.HISTORY, page=page).run(), + YggTorrent('', return_type=ConnectorReturn.HISTORY, page=page).run(), + YggAnimation('', return_type=ConnectorReturn.HISTORY, page=page).run(), + AnimeUltime('', return_type=ConnectorReturn.HISTORY, page=page).run(), ] results = [] for torrent in torrents: results = results + torrent.data - results.sort(key=itemgetter('date')) + results.sort(key=itemgetter('date'), reverse=True) for keyword in AnimeTitle.query.all(): for result in results: result['name'] = Connector.boldify(result['name'], keyword) - return render_template('latest.html', form=SearchForm(), torrents=results) + return render_template('latest.html', form=SearchForm(), torrents=results, page=page) @app.route('/list') def list_animes(): - return 'Hello!' + results = [] + + return render_template('list.html', form=SearchForm(), torrents=results) @app.route('/admin') diff --git a/connectors.py b/connectors.py index e08dcc1..246ae22 100644 --- a/connectors.py +++ b/connectors.py @@ -149,7 +149,7 @@ class Nyaa(Connector): def get_full_search_url(self): sort_type = 'size' if self.return_type is ConnectorReturn.HISTORY: - sort_type = 'date' + sort_type = 'id' to_query = '(%s vf)|(%s vostfr)|(%s multi)|(%s french)' % (self.query, self.query, self.query, self.query) return '%s/?f=0&c=1_3&s=%s&o=desc&q=%s&p=%s' % (self.base_url, sort_type, to_query, self.page) @@ -299,7 +299,7 @@ class YggTorrent(Connector): color = 'is-success' title = 'YggTorrent' favicon = 'yggtorrent.png' - base_url = 'https://www2.yggtorrent.pe' + base_url = 'https://www2.yggtorrent.ws' is_light = False is_behind_cloudflare = True category = 2179 @@ -307,7 +307,7 @@ class YggTorrent(Connector): def get_full_search_url(self): sort_type = 'size' if self.return_type is ConnectorReturn.HISTORY: - sort_type = 'date' + sort_type = 'publish_date' return '%s/engine/search?do=search&order=desc&sort=%s&category=2145&sub_category=%s&name=%s&page=%s' % ( self.base_url, sort_type, self.category, self.query, self.page diff --git a/templates/latest.html b/templates/latest.html index e29e1b1..49fec88 100644 --- a/templates/latest.html +++ b/templates/latest.html @@ -1,5 +1,5 @@ {% extends "layout.html" %} -{% block title %} - Latest{% endblock %} +{% block title %} - Latest torrents{% endblock %} {% block body %} @@ -24,53 +24,68 @@ {% for torrent in torrents %} - {% if torrent.self.is_light %} - - - - {% else %} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} - {% endif %} + {% if torrent.self.is_light %} + + + + {% else %} + + + + + + + + {% endif %} {% endfor %}
- -   - {{ torrent.lang.value }} - - {{ torrent.name }} - - - {{ torrent.date }} - - {{ torrent.type }} - #} -{# #} -{#  #} -{# {{ torrent.lang.value }}#} -{# #} -{# \0', $this->raw($tr['name']))); ?>#} -{# #} -{# #} -{# raw($tr['link'])); ?>#} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# #} -{# + +   + {{ torrent.lang.value }} + + {{ torrent.name }} + + + {{ torrent.date }} + + {{ torrent.type }} + + +   + {{ torrent.lang.value }} + + {{ torrent.name }} + + + {{ torrent.link|safe }} + {{ torrent.comment|safe }} + + {{ torrent.size }} + + {{ torrent.date }} + + {{ torrent.seeds }} + + {{ torrent.leechs }} + + {{ torrent.downloads }} +
+ + {% endblock %} diff --git a/templates/list.html b/templates/list.html new file mode 100644 index 0000000..1c7ca16 --- /dev/null +++ b/templates/list.html @@ -0,0 +1,17 @@ +{% extends "layout.html" %} +{% block title %} - My seeded torrents{% endblock %} +{% block body %} + + + + + + + + + + + + +
NameLinkSeasonTools
+{% endblock %}