mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-09 21:49:57 +08:00
Add local proxy
This commit is contained in:
@@ -80,9 +80,14 @@ async def update_config(config: Config):
|
||||
return api_func.update_config(config)
|
||||
|
||||
|
||||
@router.get("/RSS/MyBangumi")
|
||||
async def get_rss(token: str):
|
||||
content = api_func.get_rss(token)
|
||||
@router.get("/RSS/{full_path:path}")
|
||||
async def get_rss(full_path: str, token: str = None, searchstr: str = None):
|
||||
if token is not None:
|
||||
full_path = full_path + "?token=" + token
|
||||
if searchstr is not None:
|
||||
full_path = full_path + "?searchstr=" + searchstr
|
||||
content = api_func.get_rss(full_path)
|
||||
print(full_path)
|
||||
return Response(content, media_type="application/xml")
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from .log import setup_logger, LOG_PATH
|
||||
from .config import settings, VERSION
|
||||
|
||||
import re
|
||||
|
||||
|
||||
TMDB_API = "32b19d6a05b512190a056fa4e747cbbc"
|
||||
DATA_PATH = "data/data.json"
|
||||
@@ -8,4 +10,6 @@ DATA_PATH = "data/data.json"
|
||||
|
||||
class RSSLink(str):
|
||||
def __new__(cls):
|
||||
return f"https://{settings.rss_parser.custom_url}/RSS/MyBangumi?token={settings.rss_parser.token}"
|
||||
if "://" not in settings.rss_parser.custom_url:
|
||||
return f"https://{settings.rss_parser.custom_url}/RSS/MyBangumi?token={settings.rss_parser.token}"
|
||||
return f"{settings.rss_parser.custom_url}/RSS/MyBangumi?token={settings.rss_parser.token}"
|
||||
|
||||
@@ -85,14 +85,17 @@ class APIProcess:
|
||||
return json_config.load(CONFIG_PATH)
|
||||
|
||||
@staticmethod
|
||||
def get_rss(token: str):
|
||||
url = f"https://mikanani.me/RSS/MyBangumi?token={token}"
|
||||
def get_rss(full_path: str):
|
||||
url = f"https://mikanani.me/RSS/{full_path}"
|
||||
custom_url = settings.rss_parser.custom_url
|
||||
if "://" not in custom_url:
|
||||
custom_url = f"https://{custom_url}"
|
||||
with RequestContent() as request:
|
||||
content = request.get_html(url)
|
||||
return re.sub(r"mikanani.me", settings.rss_parser.custom_url, content)
|
||||
return re.sub(r"https://mikanani.me", custom_url, content)
|
||||
|
||||
@staticmethod
|
||||
def get_torrent(full_path):
|
||||
url = f"https://mikanani.me/Downloads/{full_path}"
|
||||
url = f"https://mikanani.me/Download/{full_path}"
|
||||
with RequestContent() as request:
|
||||
return request.get_content(url)
|
||||
|
||||
@@ -9,7 +9,7 @@ from module.core.download_client import DownloadClient
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
SEARCH_KEY = ["group", "title_raw", "season_raw", "subtitle", "source", "dpi"]
|
||||
CUSTOM_URL = "mikanani.me" if settings.rss_parser.custom_url == "" else settings.rss_parser.custom_url
|
||||
CUSTOM_URL = "https://mikanani.me" if settings.rss_parser.custom_url == "" else settings.rss_parser.custom_url
|
||||
|
||||
|
||||
class FullSeasonGet:
|
||||
@@ -26,7 +26,7 @@ class FullSeasonGet:
|
||||
def get_season_torrents(self, data: dict):
|
||||
keyword = self.init_eps_complete_search_str(data)
|
||||
with RequestContent() as req:
|
||||
torrents = req.get_torrents(f"https://{CUSTOM_URL}/RSS/Search?searchstr={keyword}")
|
||||
torrents = req.get_torrents(f"{CUSTOM_URL}/RSS/Search?searchstr={keyword}")
|
||||
return torrents
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -9,8 +9,6 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class PostNotification:
|
||||
def __init__(self):
|
||||
self.token = settings.notification_token
|
||||
self.notification_url = lambda message: f"https://api.pushbullet.com/v2/{self.token}/{message}"
|
||||
self.client = self.getClient()
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user