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')
|
||||
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')
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block title %} - Latest{% endblock %}
|
||||
{% block title %} - Latest torrents{% endblock %}
|
||||
{% block body %}
|
||||
<table class="table is-bordered is-striped is-narrow is-fullwidth is-hoverable is-size-7">
|
||||
<thead>
|
||||
@ -24,53 +24,68 @@
|
||||
{% for torrent in torrents %}
|
||||
<tr class="{{ torrent.class }}">
|
||||
|
||||
{% if torrent.self.is_light %}
|
||||
<td colspan="3">
|
||||
<img class="favicon" src="{{ url_for('static', filename='favicons/%s' % torrent.self.favicon) }}" alt="">
|
||||
<i> </i>
|
||||
{{ torrent.lang.value }}
|
||||
<a href="{{ torrent.href }}" target="_blank">
|
||||
{{ torrent.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.date }}
|
||||
</td>
|
||||
<td colspan="3">
|
||||
{{ torrent.type }}
|
||||
</td>
|
||||
{% else %}
|
||||
{# <td>#}
|
||||
{# <img class="favicon" src="{{ url_for('static', filename='favicons/%s' % torrent.self.favicon) }}" alt="">#}
|
||||
{# <i> </i>#}
|
||||
{# {{ torrent.lang.value }}#}
|
||||
{# <a href="<?php e($tr['href']); ?>" target="_blank">#}
|
||||
{# <?php e(preg_replace('/' . implode('|', $keywords) . '/i', '<b>\0</b>', $this->raw($tr['name']))); ?>#}
|
||||
{# </a>#}
|
||||
{# </td>#}
|
||||
{# <td>#}
|
||||
{# <?php e($this->raw($tr['link'])); ?>#}
|
||||
{# </td>#}
|
||||
{# <td>#}
|
||||
{# <?php e($tr['size']); ?>#}
|
||||
{# </td>#}
|
||||
{# <td>#}
|
||||
{# <?php e($tr['date']); ?>#}
|
||||
{# </td>#}
|
||||
{# <td>#}
|
||||
{# <?php e($tr['seeds']); ?>#}
|
||||
{# </td>#}
|
||||
{# <td>#}
|
||||
{# <?php e($tr['leechs']); ?>#}
|
||||
{# </td>#}
|
||||
{# <td>#}
|
||||
{# <?php e($tr['check']); ?>#}
|
||||
{# </td>#}
|
||||
{% endif %}
|
||||
{% if torrent.self.is_light %}
|
||||
<td colspan="3">
|
||||
<img class="favicon"
|
||||
src="{{ url_for('static', filename='favicons/%s' % torrent.self.favicon) }}" alt="">
|
||||
<i> </i>
|
||||
{{ torrent.lang.value }}
|
||||
<a href="{{ torrent.href }}" target="_blank">
|
||||
{{ torrent.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.date }}
|
||||
</td>
|
||||
<td colspan="3">
|
||||
{{ torrent.type }}
|
||||
</td>
|
||||
{% else %}
|
||||
<td>
|
||||
<img class="favicon"
|
||||
src="{{ url_for('static', filename='favicons/%s' % torrent.self.favicon) }}" alt="">
|
||||
<i> </i>
|
||||
{{ torrent.lang.value }}
|
||||
<a href="{{ torrent.href }}" target="_blank">
|
||||
{{ torrent.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.link|safe }}
|
||||
{{ torrent.comment|safe }}
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.size }}
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.date }}
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.seeds }}
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.leechs }}
|
||||
</td>
|
||||
<td>
|
||||
{{ torrent.downloads }}
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</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 %}
|
||||
|
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