This commit is contained in:
parent
4d0a312c1a
commit
ba953ccd58
@ -6,6 +6,7 @@ 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
|
||||||
@ -14,6 +15,7 @@ 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):
|
||||||
@ -252,7 +254,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': datetime.strptime(tds[4].string, '%Y-%m-%d %H:%M'),
|
'date': utc.localize(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,
|
||||||
@ -316,7 +318,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': parse(tds[7]['title']),
|
'date': utc.localize(parse(tds[7]['title'])),
|
||||||
'seeds': check_seeds,
|
'seeds': check_seeds,
|
||||||
'leechs': tds[5].string,
|
'leechs': tds[5].string,
|
||||||
'downloads': check_downloads,
|
'downloads': check_downloads,
|
||||||
@ -385,7 +387,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': datetime.fromtimestamp(int(tds[4].div.string)),
|
'date': utc.localize(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,
|
||||||
@ -450,7 +452,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': datetime.fromtimestamp(0),
|
'date': utc.localize(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:
|
||||||
@ -464,7 +466,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': datetime.fromtimestamp(0),
|
'date': utc.localize(datetime.fromtimestamp(0)),
|
||||||
'class': self.color if link_exist_in_db(href) else ''
|
'class': self.color if link_exist_in_db(href) else ''
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -493,7 +495,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': parse(h3s[i].string[:-3], languages=['fr']),
|
'date': utc.localize(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