Use get_text instead of string, update bulma-tooltip, update beautifulsoap
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2020-05-20 16:25:08 +02:00
parent 91cd067352
commit 3ee44fcb0d
11 changed files with 31 additions and 41 deletions

View File

@ -36,7 +36,7 @@ class AnimeUltime(ConnectorCore):
title = html.select('div.title') title = html.select('div.title')
player = html.select('div.AUVideoPlayer') player = html.select('div.AUVideoPlayer')
if 'Recherche' in title[0].decode_contents(): if 'Recherche' in title[0].get_text():
trs = html.select('table.jtable tr') trs = html.select('table.jtable tr')
for i, tr in enumerate(trs): for i, tr in enumerate(trs):
@ -55,7 +55,7 @@ class AnimeUltime(ConnectorCore):
'lang': ConnectorLang.JP, 'lang': ConnectorLang.JP,
'href': '%s/%s' % (self.base_url, url['href']), 'href': '%s/%s' % (self.base_url, url['href']),
'name': url.get_text(), 'name': url.get_text(),
'type': tds[1].string, 'type': tds[1].get_text(),
'date': parse_date(None), 'date': parse_date(None),
'class': self.color if link_exist_in_db(href) else '' 'class': self.color if link_exist_in_db(href) else ''
}) })
@ -67,8 +67,8 @@ class AnimeUltime(ConnectorCore):
self.data.append({ self.data.append({
'lang': ConnectorLang.JP, 'lang': ConnectorLang.JP,
'href': '%s/file-0-1/%s' % (self.base_url, player[0]['data-serie']), 'href': '%s/file-0-1/%s' % (self.base_url, player[0]['data-serie']),
'name': name[0].string, 'name': name[0].get_text(),
'type': ani_type[0].string.replace(':', ''), 'type': ani_type[0].get_text().replace(':', ''),
'date': parse_date(None), 'date': parse_date(None),
'class': self.color if link_exist_in_db(href) else '' 'class': self.color if link_exist_in_db(href) else ''
}) })
@ -96,8 +96,8 @@ class AnimeUltime(ConnectorCore):
self.data.append({ self.data.append({
'lang': ConnectorLang.JP, 'lang': ConnectorLang.JP,
'href': '%s/%s' % (self.base_url, link['href']), 'href': '%s/%s' % (self.base_url, link['href']),
'name': link.string, 'name': link.get_text(),
'type': tds[4].string, 'type': tds[4].get_text(),
'date': parse_date(h3s[i].string[:-3], '%A %d %B %Y'), 'date': parse_date(h3s[i].string[:-3], '%A %d %B %Y'),
'class': self.color if link_exist_in_db(href) else '' 'class': self.color if link_exist_in_db(href) else ''
}) })

View File

@ -1,5 +0,0 @@
from cloudscraper import CloudScraper
class CloudScraperWrapper(CloudScraper):
pass

View File

@ -5,13 +5,13 @@ from enum import Enum
from functools import wraps from functools import wraps
from logging import getLogger from logging import getLogger
from cloudscraper import create_scraper
from cloudscraper.exceptions import CloudflareException, reCaptchaException from cloudscraper.exceptions import CloudflareException, reCaptchaException
from requests import RequestException from requests import RequestException
from .cloudscraper import CloudScraperWrapper
from ..config import CACHE_TIMEOUT, IS_DEBUG, REQUESTS_TIMEOUT, TWOCAPTCHA_API_KEY from ..config import CACHE_TIMEOUT, IS_DEBUG, REQUESTS_TIMEOUT, TWOCAPTCHA_API_KEY
scraper = CloudScraperWrapper.create_scraper(browser={ scraper = create_scraper(browser={
'custom': 'ScraperBot/1.0' 'custom': 'ScraperBot/1.0'
}, recaptcha=TWOCAPTCHA_API_KEY) }, recaptcha=TWOCAPTCHA_API_KEY)

View File

@ -36,8 +36,8 @@ class Nyaa(ConnectorCore):
continue continue
tds = tr.findAll('td') tds = tr.findAll('td')
check_downloads = int(tds[7].string) check_downloads = int(tds[7].get_text())
check_seeds = int(tds[5].string) check_seeds = int(tds[5].get_text())
if check_downloads or check_seeds: if check_downloads or check_seeds:
urls = tds[1].findAll('a') urls = tds[1].findAll('a')
@ -63,10 +63,10 @@ class Nyaa(ConnectorCore):
'name': url_safe, 'name': url_safe,
'comment': str(urls[0]).replace('/view/', self.base_url + '/view/') if has_comment else '', 'comment': str(urls[0]).replace('/view/', self.base_url + '/view/') if has_comment else '',
'link': tds[2].decode_contents().replace('/download/', self.base_url + '/download/'), 'link': tds[2].decode_contents().replace('/download/', self.base_url + '/download/'),
'size': tds[3].string, 'size': tds[3].get_text(),
'date': parse_date(tds[4].string, '%Y-%m-%d %H:%M'), 'date': parse_date(tds[4].get_text(), '%Y-%m-%d %H:%M'),
'seeds': check_seeds, 'seeds': check_seeds,
'leechs': tds[6].string, 'leechs': tds[6].get_text(),
'downloads': check_downloads, 'downloads': check_downloads,
'class': self.color if link_exist_in_db(href) else 'is-%s' % tr['class'][0] 'class': self.color if link_exist_in_db(href) else 'is-%s' % tr['class'][0]
}) })

View File

@ -36,8 +36,8 @@ class Pantsu(ConnectorCore):
continue continue
tds = tr.findAll('td') tds = tr.findAll('td')
check_downloads = int(tds[6].string.replace('-', '0')) check_downloads = int(tds[6].get_text().replace('-', '0'))
check_seeds = int(tds[4].string.replace('-', '0')) check_seeds = int(tds[4].get_text().replace('-', '0'))
if check_downloads or check_seeds: if check_downloads or check_seeds:
url = tds[1].a url = tds[1].a
@ -56,10 +56,10 @@ class Pantsu(ConnectorCore):
'comment': '', 'comment': '',
'link': tds[2].decode_contents().replace('icon-magnet', 'fa fa-fw fa-magnet').replace( 'link': tds[2].decode_contents().replace('icon-magnet', 'fa fa-fw fa-magnet').replace(
'icon-floppy', 'fa fa-fw fa-download'), 'icon-floppy', 'fa fa-fw fa-download'),
'size': tds[3].string, 'size': tds[3].get_text(),
'date': parse_date(tds[7]['title'][:-6], '%m/%d/%Y, %I:%M:%S %p'), 'date': parse_date(tds[7]['title'][:-6], '%m/%d/%Y, %I:%M:%S %p'),
'seeds': check_seeds, 'seeds': check_seeds,
'leechs': tds[5].string, 'leechs': tds[5].get_text(),
'downloads': check_downloads, 'downloads': check_downloads,
'class': self.color if link_exist_in_db(href) else 'is-%s' % tr['class'][0] 'class': self.color if link_exist_in_db(href) else 'is-%s' % tr['class'][0]
}) })

View File

@ -44,8 +44,8 @@ class YggTorrent(ConnectorCore):
continue continue
tds = tr.findAll('td') tds = tr.findAll('td')
check_downloads = int(tds[6].string) check_downloads = int(tds[6].get_text())
check_seeds = int(tds[7].string) check_seeds = int(tds[7].get_text())
if check_downloads or check_seeds: if check_downloads or check_seeds:
url = tds[1].a url = tds[1].a
@ -65,10 +65,10 @@ class YggTorrent(ConnectorCore):
'link': '<a href="%s/engine/download_torrent?id=%s">' 'link': '<a href="%s/engine/download_torrent?id=%s">'
'<i class="fa fa-fw fa-download"></i>' '<i class="fa fa-fw fa-download"></i>'
'</a>' % (self.base_url, re.search(r'/(\d+)', url['href']).group(1)), '</a>' % (self.base_url, re.search(r'/(\d+)', url['href']).group(1)),
'size': tds[5].string, 'size': tds[5].get_text(),
'date': parse_date(datetime.fromtimestamp(int(tds[4].div.string))), 'date': parse_date(datetime.fromtimestamp(int(tds[4].div.get_text()))),
'seeds': check_seeds, 'seeds': check_seeds,
'leechs': tds[8].string, 'leechs': tds[8].get_text(),
'downloads': check_downloads, 'downloads': check_downloads,
'class': self.color if link_exist_in_db(quote(url['href'], '/+:')) else '' 'class': self.color if link_exist_in_db(quote(url['href'], '/+:')) else ''
}) })

File diff suppressed because one or more lines are too long

View File

@ -96,9 +96,3 @@ label.checkbox {
.table.is-hoverable tbody tr:not(.is-selected):hover { .table.is-hoverable tbody tr:not(.is-selected):hover {
background-color: #f1f1f1 !important; background-color: #f1f1f1 !important;
} }
@media screen and (min-width: 1088px) {
[data-tooltip]:hover::before, [data-tooltip]:hover::after {
display: none !important;
}
}

View File

@ -1,7 +1,7 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block title %}- Admin List{% endblock %} {% block title %}- Admin List{% endblock %}
{% block add_button %} {% block add_button %}
<a class="navbar-item has-tooltip-bottom" data-tooltip="Add entry" href="{{ url_for('admin_edit') }}"> <a class="navbar-item has-tooltip-bottom has-tooltip-hidden-desktop" data-tooltip="Add entry" href="{{ url_for('admin_edit') }}">
<i class="fa fa-plus"></i><i>&nbsp;</i> <i class="fa fa-plus"></i><i>&nbsp;</i>
<span class="is-hidden-mobile">Add entry</span> <span class="is-hidden-mobile">Add entry</span>
</a> </a>

View File

@ -16,15 +16,15 @@
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> <nav class="navbar is-dark" role="navigation" aria-label="main navigation">
<div class="navbar-start"> <div class="navbar-start">
<a class="navbar-item has-tooltip-bottom" data-tooltip="Home" href="{{ url_for('home') }}"> <a class="navbar-item has-tooltip-bottom has-tooltip-hidden-desktop" data-tooltip="Home" href="{{ url_for('home') }}">
π 😼た π 😼た
</a> </a>
<a class="navbar-item has-tooltip-bottom" data-tooltip="Latest torrents" href="{{ url_for('latest') }}"> <a class="navbar-item has-tooltip-bottom has-tooltip-hidden-desktop" data-tooltip="Latest torrents" href="{{ url_for('latest') }}">
<i class="fa fa-newspaper-o"></i><i>&nbsp;</i> <i class="fa fa-newspaper-o"></i><i>&nbsp;</i>
<span class="is-hidden-mobile">Latest torrents</span> <span class="is-hidden-mobile">Latest torrents</span>
</a> </a>
{% if not mysql_disabled %} {% if not mysql_disabled %}
<a class="navbar-item has-tooltip-bottom" data-tooltip="My seeded torrents" <a class="navbar-item has-tooltip-bottom has-tooltip-hidden-desktop" data-tooltip="My seeded torrents"
href="{{ url_for('list_animes') }}"> href="{{ url_for('list_animes') }}">
<i class="fa fa-cloud-download"></i><i>&nbsp;</i> <i class="fa fa-cloud-download"></i><i>&nbsp;</i>
<span class="is-hidden-mobile">My seeded torrents</span> <span class="is-hidden-mobile">My seeded torrents</span>
@ -32,13 +32,13 @@
{% endif %} {% endif %}
{% block add_button %}{% endblock %} {% block add_button %}{% endblock %}
{% if request.args.get('q') %} {% if request.args.get('q') %}
<a class="navbar-item has-tooltip-bottom" data-tooltip="TVDB" <a class="navbar-item has-tooltip-bottom has-tooltip-hidden-desktop" data-tooltip="TVDB"
href="https://www.thetvdb.com/search?menu%5Btype%5D=TV&query={{ request.args.get('q') }}" href="https://www.thetvdb.com/search?menu%5Btype%5D=TV&query={{ request.args.get('q') }}"
target="_blank"> target="_blank">
<i class="fa fa-television"></i><i>&nbsp;</i> <i class="fa fa-television"></i><i>&nbsp;</i>
<span class="is-hidden-mobile">TVDB</span> <span class="is-hidden-mobile">TVDB</span>
</a> </a>
<a class="navbar-item has-tooltip-bottom" data-tooltip="Nautiljon" <a class="navbar-item has-tooltip-bottom has-tooltip-hidden-desktop" data-tooltip="Nautiljon"
href="https://www.nautiljon.com/search.php?q={{ request.args.get('q') }}" target="_blank"> href="https://www.nautiljon.com/search.php?q={{ request.args.get('q') }}" target="_blank">
<i class="fa fa-rss"></i><i>&nbsp;</i> <i class="fa fa-rss"></i><i>&nbsp;</i>
<span class="is-hidden-mobile">Nautiljon</span> <span class="is-hidden-mobile">Nautiljon</span>

View File

@ -5,7 +5,7 @@ Flask-WTF==0.14.3
WTForms==2.3.1 WTForms==2.3.1
PyMySQL==0.9.3 PyMySQL==0.9.3
requests==2.23.0 requests==2.23.0
beautifulsoup4==4.9.0 beautifulsoup4==4.9.1
python-dotenv==0.13.0 python-dotenv==0.13.0
cloudscraper==1.2.38 cloudscraper==1.2.38
polling==0.3.1 polling==0.3.1