mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-14 02:20:53 +08:00
Fix status bug.
Fix log level of uvicorn access.
This commit is contained in:
@@ -18,7 +18,6 @@ def check_status() -> bool:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def check_downloader():
|
||||
with DownloadClient() as client:
|
||||
if client.authed:
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import re
|
||||
import logging
|
||||
import xml.etree.ElementTree
|
||||
from typing import Tuple
|
||||
|
||||
from module.conf import settings
|
||||
from module.utils import json_config
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RSSFilter:
|
||||
def __init__(self):
|
||||
self.filter_rule = json_config.load(settings.filter_rule)
|
||||
|
||||
def filter(self, item: xml.etree.ElementTree.Element) -> Tuple[bool, str]:
|
||||
title = item.find("title").text
|
||||
torrent = item.find("enclosure").attrib["url"]
|
||||
download = False
|
||||
for rule in self.filter_rule:
|
||||
if re.search(rule["include"], title):
|
||||
if not re.search(rule["exclude"], title):
|
||||
download = True
|
||||
logger.debug(f"{title} added")
|
||||
return download, torrent
|
||||
@@ -1,15 +1,16 @@
|
||||
from module.network import RequestContent
|
||||
|
||||
|
||||
class BgmAPI:
|
||||
def __init__(self):
|
||||
self.search_url = lambda e: f"https://api.bgm.tv/search/subject/{e}?type=2"
|
||||
self.info_url = lambda e: f"https://api.bgm.tv/subject/{e}"
|
||||
search_url = lambda e: \
|
||||
f"https://api.bgm.tv/search/subject/{e}?responseGroup=large"
|
||||
|
||||
|
||||
def bgm_parser(title):
|
||||
url = search_url(title)
|
||||
with RequestContent() as req:
|
||||
contents = req.get_json(url)
|
||||
if contents:
|
||||
return contents[0]
|
||||
else:
|
||||
return None
|
||||
|
||||
def search(self, title):
|
||||
url = self.search_url(title)
|
||||
with RequestContent() as req:
|
||||
contents = req.get_json(url)["list"]
|
||||
if contents.__len__() == 0:
|
||||
return None
|
||||
return contents[0]["name"], contents[0]["name_cn"]
|
||||
|
||||
Reference in New Issue
Block a user