Don't use pytz and substr the UTC
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ba953ccd58
commit
01da5c1462
@ -6,7 +6,6 @@ from functools import wraps
|
|||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
import pytz
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from cloudscraper import create_scraper
|
from cloudscraper import create_scraper
|
||||||
from dateparser import parse
|
from dateparser import parse
|
||||||
@ -15,7 +14,6 @@ from requests import RequestException
|
|||||||
from pynyaata.config import IS_DEBUG, MYSQL_ENABLED, CACHE_TIMEOUT, BLACKLIST_WORDS
|
from pynyaata.config import IS_DEBUG, MYSQL_ENABLED, CACHE_TIMEOUT, BLACKLIST_WORDS
|
||||||
|
|
||||||
scraper = create_scraper()
|
scraper = create_scraper()
|
||||||
utc = pytz.UTC
|
|
||||||
|
|
||||||
|
|
||||||
class ConnectorReturn(Enum):
|
class ConnectorReturn(Enum):
|
||||||
@ -254,7 +252,7 @@ class Nyaa(Connector):
|
|||||||
'link': tds[2].decode_contents().replace('/download/',
|
'link': tds[2].decode_contents().replace('/download/',
|
||||||
'%s%s' % (self.base_url, '/download/')),
|
'%s%s' % (self.base_url, '/download/')),
|
||||||
'size': tds[3].string,
|
'size': tds[3].string,
|
||||||
'date': utc.localize(datetime.strptime(tds[4].string, '%Y-%m-%d %H:%M')),
|
'date': datetime.strptime(tds[4].string, '%Y-%m-%d %H:%M'),
|
||||||
'seeds': check_seeds,
|
'seeds': check_seeds,
|
||||||
'leechs': tds[6].string,
|
'leechs': tds[6].string,
|
||||||
'downloads': check_downloads,
|
'downloads': check_downloads,
|
||||||
@ -318,7 +316,7 @@ class Pantsu(Connector):
|
|||||||
'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].string,
|
||||||
'date': utc.localize(parse(tds[7]['title'])),
|
'date': parse(tds[7]['title'][:-6]),
|
||||||
'seeds': check_seeds,
|
'seeds': check_seeds,
|
||||||
'leechs': tds[5].string,
|
'leechs': tds[5].string,
|
||||||
'downloads': check_downloads,
|
'downloads': check_downloads,
|
||||||
@ -387,7 +385,7 @@ class YggTorrent(Connector):
|
|||||||
'<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].string,
|
||||||
'date': utc.localize(datetime.fromtimestamp(int(tds[4].div.string))),
|
'date': datetime.fromtimestamp(int(tds[4].div.string)),
|
||||||
'seeds': check_seeds,
|
'seeds': check_seeds,
|
||||||
'leechs': tds[8].string,
|
'leechs': tds[8].string,
|
||||||
'downloads': check_downloads,
|
'downloads': check_downloads,
|
||||||
@ -452,7 +450,7 @@ class AnimeUltime(Connector):
|
|||||||
'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].string,
|
||||||
'date': utc.localize(datetime.fromtimestamp(0)),
|
'date': datetime.fromtimestamp(0),
|
||||||
'class': self.color if link_exist_in_db(href) else ''
|
'class': self.color if link_exist_in_db(href) else ''
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
@ -466,7 +464,7 @@ class AnimeUltime(Connector):
|
|||||||
'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].string,
|
||||||
'type': ani_type[0].string.replace(':', ''),
|
'type': ani_type[0].string.replace(':', ''),
|
||||||
'date': utc.localize(datetime.fromtimestamp(0)),
|
'date': datetime.fromtimestamp(0),
|
||||||
'class': self.color if link_exist_in_db(href) else ''
|
'class': self.color if link_exist_in_db(href) else ''
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -495,7 +493,7 @@ class AnimeUltime(Connector):
|
|||||||
'href': '%s/%s' % (self.base_url, link['href']),
|
'href': '%s/%s' % (self.base_url, link['href']),
|
||||||
'name': link.string,
|
'name': link.string,
|
||||||
'type': tds[4].string,
|
'type': tds[4].string,
|
||||||
'date': utc.localize(parse(h3s[i].string[:-3], languages=['fr'])),
|
'date': parse(h3s[i].string[:-3], languages=['fr']),
|
||||||
'class': self.color if link_exist_in_db(href) else ''
|
'class': self.color if link_exist_in_db(href) else ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user