Finalized latest
This commit is contained in:
parent
5de3a85231
commit
931df1225f
20
app.py
20
app.py
@ -38,29 +38,33 @@ def search():
|
|||||||
|
|
||||||
@app.route('/latest')
|
@app.route('/latest')
|
||||||
def latest():
|
def latest():
|
||||||
|
page = request.args.get('page', 1)
|
||||||
|
|
||||||
torrents = [
|
torrents = [
|
||||||
Nyaa('', 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=request.args.get('page', 1)).run(),
|
Pantsu('', return_type=ConnectorReturn.HISTORY, page=page).run(),
|
||||||
YggTorrent('', return_type=ConnectorReturn.HISTORY, page=request.args.get('page', 1)).run(),
|
YggTorrent('', return_type=ConnectorReturn.HISTORY, page=page).run(),
|
||||||
YggAnimation('', return_type=ConnectorReturn.HISTORY, page=request.args.get('page', 1)).run(),
|
YggAnimation('', return_type=ConnectorReturn.HISTORY, page=page).run(),
|
||||||
AnimeUltime('', return_type=ConnectorReturn.HISTORY, page=request.args.get('page', 1)).run(),
|
AnimeUltime('', return_type=ConnectorReturn.HISTORY, page=page).run(),
|
||||||
]
|
]
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
for torrent in torrents:
|
for torrent in torrents:
|
||||||
results = results + torrent.data
|
results = results + torrent.data
|
||||||
results.sort(key=itemgetter('date'))
|
results.sort(key=itemgetter('date'), reverse=True)
|
||||||
|
|
||||||
for keyword in AnimeTitle.query.all():
|
for keyword in AnimeTitle.query.all():
|
||||||
for result in results:
|
for result in results:
|
||||||
result['name'] = Connector.boldify(result['name'], keyword)
|
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')
|
@app.route('/list')
|
||||||
def list_animes():
|
def list_animes():
|
||||||
return 'Hello!'
|
results = []
|
||||||
|
|
||||||
|
return render_template('list.html', form=SearchForm(), torrents=results)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/admin')
|
@app.route('/admin')
|
||||||
|
@ -149,7 +149,7 @@ class Nyaa(Connector):
|
|||||||
def get_full_search_url(self):
|
def get_full_search_url(self):
|
||||||
sort_type = 'size'
|
sort_type = 'size'
|
||||||
if self.return_type is ConnectorReturn.HISTORY:
|
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)
|
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)
|
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'
|
color = 'is-success'
|
||||||
title = 'YggTorrent'
|
title = 'YggTorrent'
|
||||||
favicon = 'yggtorrent.png'
|
favicon = 'yggtorrent.png'
|
||||||
base_url = 'https://www2.yggtorrent.pe'
|
base_url = 'https://www2.yggtorrent.ws'
|
||||||
is_light = False
|
is_light = False
|
||||||
is_behind_cloudflare = True
|
is_behind_cloudflare = True
|
||||||
category = 2179
|
category = 2179
|
||||||
@ -307,7 +307,7 @@ class YggTorrent(Connector):
|
|||||||
def get_full_search_url(self):
|
def get_full_search_url(self):
|
||||||
sort_type = 'size'
|
sort_type = 'size'
|
||||||
if self.return_type is ConnectorReturn.HISTORY:
|
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' % (
|
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
|
self.base_url, sort_type, self.category, self.query, self.page
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %}
|
||||||
{% block title %} - Latest{% endblock %}
|
{% block title %} - Latest torrents{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<table class="table is-bordered is-striped is-narrow is-fullwidth is-hoverable is-size-7">
|
<table class="table is-bordered is-striped is-narrow is-fullwidth is-hoverable is-size-7">
|
||||||
<thead>
|
<thead>
|
||||||
@ -24,53 +24,68 @@
|
|||||||
{% for torrent in torrents %}
|
{% for torrent in torrents %}
|
||||||
<tr class="{{ torrent.class }}">
|
<tr class="{{ torrent.class }}">
|
||||||
|
|
||||||
{% if torrent.self.is_light %}
|
{% if torrent.self.is_light %}
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<img class="favicon" src="{{ url_for('static', filename='favicons/%s' % torrent.self.favicon) }}" alt="">
|
<img class="favicon"
|
||||||
<i> </i>
|
src="{{ url_for('static', filename='favicons/%s' % torrent.self.favicon) }}" alt="">
|
||||||
{{ torrent.lang.value }}
|
<i> </i>
|
||||||
<a href="{{ torrent.href }}" target="_blank">
|
{{ torrent.lang.value }}
|
||||||
{{ torrent.name }}
|
<a href="{{ torrent.href }}" target="_blank">
|
||||||
</a>
|
{{ torrent.name }}
|
||||||
</td>
|
</a>
|
||||||
<td>
|
</td>
|
||||||
{{ torrent.date }}
|
<td>
|
||||||
</td>
|
{{ torrent.date }}
|
||||||
<td colspan="3">
|
</td>
|
||||||
{{ torrent.type }}
|
<td colspan="3">
|
||||||
</td>
|
{{ torrent.type }}
|
||||||
{% else %}
|
</td>
|
||||||
{# <td>#}
|
{% else %}
|
||||||
{# <img class="favicon" src="{{ url_for('static', filename='favicons/%s' % torrent.self.favicon) }}" alt="">#}
|
<td>
|
||||||
{# <i> </i>#}
|
<img class="favicon"
|
||||||
{# {{ torrent.lang.value }}#}
|
src="{{ url_for('static', filename='favicons/%s' % torrent.self.favicon) }}" alt="">
|
||||||
{# <a href="<?php e($tr['href']); ?>" target="_blank">#}
|
<i> </i>
|
||||||
{# <?php e(preg_replace('/' . implode('|', $keywords) . '/i', '<b>\0</b>', $this->raw($tr['name']))); ?>#}
|
{{ torrent.lang.value }}
|
||||||
{# </a>#}
|
<a href="{{ torrent.href }}" target="_blank">
|
||||||
{# </td>#}
|
{{ torrent.name }}
|
||||||
{# <td>#}
|
</a>
|
||||||
{# <?php e($this->raw($tr['link'])); ?>#}
|
</td>
|
||||||
{# </td>#}
|
<td>
|
||||||
{# <td>#}
|
{{ torrent.link|safe }}
|
||||||
{# <?php e($tr['size']); ?>#}
|
{{ torrent.comment|safe }}
|
||||||
{# </td>#}
|
</td>
|
||||||
{# <td>#}
|
<td>
|
||||||
{# <?php e($tr['date']); ?>#}
|
{{ torrent.size }}
|
||||||
{# </td>#}
|
</td>
|
||||||
{# <td>#}
|
<td>
|
||||||
{# <?php e($tr['seeds']); ?>#}
|
{{ torrent.date }}
|
||||||
{# </td>#}
|
</td>
|
||||||
{# <td>#}
|
<td>
|
||||||
{# <?php e($tr['leechs']); ?>#}
|
{{ torrent.seeds }}
|
||||||
{# </td>#}
|
</td>
|
||||||
{# <td>#}
|
<td>
|
||||||
{# <?php e($tr['check']); ?>#}
|
{{ torrent.leechs }}
|
||||||
{# </td>#}
|
</td>
|
||||||
{% endif %}
|
<td>
|
||||||
|
{{ torrent.downloads }}
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<nav class="pagination is-right" role="navigation" aria-label="pagination">
|
||||||
|
{% if page > 1 %}
|
||||||
|
<a class="pagination-previous" href="{{ url_for('latest', q=request.args.get('q'), page=(page - 1)) }}">
|
||||||
|
Previous
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
<a class="pagination-next" href="{{ url_for('latest', q=request.args.get('q'), page=(page + 1)) }}">
|
||||||
|
Next page
|
||||||
|
</a>
|
||||||
|
<ul class="pagination-list"></ul>
|
||||||
|
</nav>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
17
templates/list.html
Normal file
17
templates/list.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{% extends "layout.html" %}
|
||||||
|
{% block title %} - My seeded torrents{% endblock %}
|
||||||
|
{% block body %}
|
||||||
|
<table class="table is-bordered is-striped is-narrow is-fullwidth is-hoverable is-size-7">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Link</th>
|
||||||
|
<th>Season</th>
|
||||||
|
<th>Tools</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
Reference in New Issue
Block a user