This commit is contained in:
parent
8eab694d02
commit
56ecddedcb
@ -12,4 +12,3 @@ REQUESTS_TIMEOUT=5
|
|||||||
CACHE_TIMEOUT=3600
|
CACHE_TIMEOUT=3600
|
||||||
MYSQL_ROOT_PASSWORD=root
|
MYSQL_ROOT_PASSWORD=root
|
||||||
BLACKLIST_WORDS=Chris44,Vol.,[zza],.ssa,.ass,Ref:rain
|
BLACKLIST_WORDS=Chris44,Vol.,[zza],.ssa,.ass,Ref:rain
|
||||||
CAPTCHA_SOLVER=hcaptcha-solver
|
|
||||||
|
@ -2,13 +2,10 @@ from asyncio import get_event_loop, set_event_loop, SelectorEventLoop
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from operator import attrgetter, itemgetter
|
from operator import attrgetter, itemgetter
|
||||||
|
|
||||||
import requests
|
from flask import redirect, render_template, request, url_for, abort
|
||||||
from flask import redirect, render_template, request, url_for, abort, json
|
|
||||||
from requests import RequestException
|
|
||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
from .config import app, auth, logger, ADMIN_USERNAME, ADMIN_PASSWORD, MYSQL_ENABLED, APP_PORT, IS_DEBUG, \
|
from .config import app, auth, ADMIN_USERNAME, ADMIN_PASSWORD, MYSQL_ENABLED, APP_PORT, IS_DEBUG, TRANSMISSION_ENABLED
|
||||||
CLOUDPROXY_ENDPOINT, TRANSMISSION_ENABLED
|
|
||||||
from .connectors import get_instance, run_all, Nyaa
|
from .connectors import get_instance, run_all, Nyaa
|
||||||
from .connectors.core import ConnectorLang, ConnectorReturn
|
from .connectors.core import ConnectorLang, ConnectorReturn
|
||||||
from .forms import SearchForm, DeleteForm, EditForm, FolderDeleteForm, FolderEditForm
|
from .forms import SearchForm, DeleteForm, EditForm, FolderDeleteForm, FolderEditForm
|
||||||
@ -120,7 +117,8 @@ def list_animes(url_filters='nyaa,yggtorrent'):
|
|||||||
else:
|
else:
|
||||||
filters = filters | AnimeLink.link.contains(to_filter)
|
filters = filters | AnimeLink.link.contains(to_filter)
|
||||||
|
|
||||||
titles = db.session.query(AnimeTitle, AnimeLink).join(AnimeLink).filter(filters).order_by(AnimeTitle.name).all()
|
titles = db.session.query(AnimeTitle, AnimeLink).join(
|
||||||
|
AnimeLink).filter(filters).order_by(AnimeTitle.name).all()
|
||||||
|
|
||||||
results = {}
|
results = {}
|
||||||
for title, link in titles:
|
for title, link in titles:
|
||||||
@ -240,7 +238,9 @@ def admin_edit(link_id=None):
|
|||||||
|
|
||||||
# Title
|
# Title
|
||||||
title = AnimeTitle.query.filter_by(id=link.title_id).first()
|
title = AnimeTitle.query.filter_by(id=link.title_id).first()
|
||||||
title = title if title else AnimeTitle.query.filter_by(name=form.name.data).first()
|
title = title if title else AnimeTitle.query.filter_by(
|
||||||
|
name=form.name.data
|
||||||
|
).first()
|
||||||
title = title if title else AnimeTitle()
|
title = title if title else AnimeTitle()
|
||||||
title.folder_id = form.folder.data
|
title.folder_id = form.folder.data
|
||||||
title.name = form.name.data
|
title.name = form.name.data
|
||||||
|
@ -3,7 +3,6 @@ from os import environ, urandom
|
|||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask.cli import load_dotenv
|
from flask.cli import load_dotenv
|
||||||
from flask_apscheduler import APScheduler
|
|
||||||
from flask_httpauth import HTTPBasicAuth
|
from flask_httpauth import HTTPBasicAuth
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
from redis import Redis
|
from redis import Redis
|
||||||
@ -18,7 +17,6 @@ APP_PORT = int(environ.get('FLASK_PORT', 5000))
|
|||||||
CACHE_TIMEOUT = int(environ.get('CACHE_TIMEOUT', 60 * 60))
|
CACHE_TIMEOUT = int(environ.get('CACHE_TIMEOUT', 60 * 60))
|
||||||
REQUESTS_TIMEOUT = int(environ.get('REQUESTS_TIMEOUT', 5))
|
REQUESTS_TIMEOUT = int(environ.get('REQUESTS_TIMEOUT', 5))
|
||||||
BLACKLIST_WORDS = environ.get('BLACKLIST_WORDS', '').split(',') if environ.get('BLACKLIST_WORDS', '') else []
|
BLACKLIST_WORDS = environ.get('BLACKLIST_WORDS', '').split(',') if environ.get('BLACKLIST_WORDS', '') else []
|
||||||
CLOUDPROXY_ENDPOINT = environ.get('CLOUDPROXY_ENDPOINT')
|
|
||||||
MYSQL_ENABLED = False
|
MYSQL_ENABLED = False
|
||||||
REDIS_ENABLED = False
|
REDIS_ENABLED = False
|
||||||
TRANSMISSION_ENABLED = False
|
TRANSMISSION_ENABLED = False
|
||||||
|
@ -4,16 +4,13 @@ from .animeultime import AnimeUltime
|
|||||||
from .core import Other
|
from .core import Other
|
||||||
from .nyaa import Nyaa
|
from .nyaa import Nyaa
|
||||||
from .yggtorrent import YggTorrent, YggAnimation
|
from .yggtorrent import YggTorrent, YggAnimation
|
||||||
from ..config import CLOUDPROXY_ENDPOINT
|
|
||||||
|
|
||||||
|
|
||||||
async def run_all(*args, **kwargs):
|
async def run_all(*args, **kwargs):
|
||||||
coroutines = [Nyaa(*args, **kwargs).run(),
|
coroutines = [Nyaa(*args, **kwargs).run(),
|
||||||
AnimeUltime(*args, **kwargs).run()]
|
AnimeUltime(*args, **kwargs).run(),
|
||||||
|
YggTorrent(*args, **kwargs).run(),
|
||||||
if CLOUDPROXY_ENDPOINT:
|
YggAnimation(*args, **kwargs).run()]
|
||||||
coroutines.extend([YggTorrent(*args, **kwargs).run(),
|
|
||||||
YggAnimation(*args, **kwargs).run()])
|
|
||||||
|
|
||||||
return list(await gather(*coroutines))
|
return list(await gather(*coroutines))
|
||||||
|
|
||||||
|
@ -2,13 +2,12 @@ from abc import ABC, abstractmethod
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from json import dumps, loads
|
from json import dumps, loads
|
||||||
from urllib.parse import urlencode
|
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from requests import RequestException
|
from requests import RequestException
|
||||||
from redis.exceptions import RedisError
|
from redis.exceptions import RedisError
|
||||||
|
|
||||||
from ..config import CACHE_TIMEOUT, REQUESTS_TIMEOUT, CLOUDPROXY_ENDPOINT, logger, REDIS_ENABLED
|
from ..config import CACHE_TIMEOUT, REQUESTS_TIMEOUT, logger, REDIS_ENABLED
|
||||||
|
|
||||||
if REDIS_ENABLED:
|
if REDIS_ENABLED:
|
||||||
from ..config import cache
|
from ..config import cache
|
||||||
@ -80,7 +79,8 @@ def curl_content(url, params=None, ajax=False, debug=True):
|
|||||||
instance = get_instance(url)
|
instance = get_instance(url)
|
||||||
|
|
||||||
if ajax:
|
if ajax:
|
||||||
headers = {'User-Agent': 'YggRobot', 'X-Requested-With': 'XMLHttpRequest'}
|
headers = {'User-Agent': 'YggRobot',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'}
|
||||||
else:
|
else:
|
||||||
headers = {'User-Agent': 'YggRobot'}
|
headers = {'User-Agent': 'YggRobot'}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user