mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-12-01 00:38:13 +08:00
2.4.10
This commit is contained in:
2
.idea/Bangumi_Auto_Rename.iml
generated
2
.idea/Bangumi_Auto_Rename.iml
generated
@@ -4,7 +4,7 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/auto_bangumi" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.10 (auto_bangumi)" jdkType="Python SDK" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (auto_bangumi)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (np_veclib)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
@@ -49,7 +49,7 @@ def show_info():
|
||||
logger.info(" /_/ \_\__,_|\__\___/|____/ \__,_|_| |_|\__, |\__,_|_| |_| |_|_|")
|
||||
logger.info(" __/ | ")
|
||||
logger.info(" |___/ ")
|
||||
logger.info("Version 2.4.9 Author: EstrellaXD Twitter: https://twitter.com/Estrella_Pan")
|
||||
logger.info("Version 2.4.10 Author: EstrellaXD Twitter: https://twitter.com/Estrella_Pan")
|
||||
logger.info("GitHub: https://github.com/EstrellaXD/Auto_Bangumi/")
|
||||
logger.info("Starting AutoBangumi...")
|
||||
|
||||
@@ -84,7 +84,7 @@ def run():
|
||||
download_client.add_rules(bangumi_data["bangumi_info"])
|
||||
if bangumi_data["first_run"]:
|
||||
logger.info(f"Waiting for downloading torrents...")
|
||||
time.sleep(600)
|
||||
time.sleep(settings.first_sleep)
|
||||
bangumi_data["first_run"] = False
|
||||
save_data_file(bangumi_data)
|
||||
renamer.run()
|
||||
@@ -94,6 +94,5 @@ def run():
|
||||
raise e
|
||||
logger.exception(e)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
|
||||
@@ -17,7 +17,8 @@ DEFAULT_SETTINGS = {
|
||||
"remove_bad_torrent": False,
|
||||
"dev_debug": False,
|
||||
"data_version": 3.1,
|
||||
"enable_eps_complete": False
|
||||
"enable_eps_complete": False,
|
||||
"first_sleep": 600
|
||||
}
|
||||
|
||||
ENV_TO_ATTR = {
|
||||
@@ -36,7 +37,8 @@ ENV_TO_ATTR = {
|
||||
lambda e: e.lower() in ("true", "1", "t")
|
||||
),
|
||||
"AB_SEASON_ONE": ("season_one_tag", lambda e: e.lower() in ("true", "1", "t")),
|
||||
"AB_REMOVE_BAD_BT": ("remove_bad_torrent", lambda e: e.lower() in ("true", "1", "t"))
|
||||
"AB_REMOVE_BAD_BT": ("remove_bad_torrent", lambda e: e.lower() in ("true", "1", "t")),
|
||||
"AB_FIRST_SLEEP": "first_sleep"
|
||||
}
|
||||
|
||||
FULL_SEASON_SUPPORT_GROUP = ["Lilith-Raws"]
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#! /usr/bin/python
|
||||
import re
|
||||
import time
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from utils import json_config
|
||||
from const import BCOLORS
|
||||
|
||||
header = {
|
||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ApplewebKit/537.36 (KHtml, like Gecko) Chrome/80.0.3987.163 Safari/537.36',
|
||||
@@ -26,7 +29,7 @@ def get_list(year, season):
|
||||
return ids
|
||||
|
||||
|
||||
def get_title(id):
|
||||
def get_title_legecy(id):
|
||||
url = "https://anidb.net/anime/%s" % id
|
||||
soup = BeautifulSoup(get_html(url), "lxml")
|
||||
titles = soup.find("div", id="tab_2_pane")
|
||||
@@ -63,14 +66,42 @@ def get_title(id):
|
||||
t_dic["kana"] = v[i].text
|
||||
return t_dic
|
||||
|
||||
|
||||
def get_title(id):
|
||||
url = f"http://api.anidb.net:9001/httpapi?request=anime&client=autobangumi&clientver=1&protover=1&aid={id}"
|
||||
req = requests.get(url)
|
||||
soup = BeautifulSoup(req.text, "xml")
|
||||
titles = soup.titles.find_all("title")
|
||||
all_title_info = {
|
||||
"id": id,
|
||||
"main": None,
|
||||
"en": None,
|
||||
"zh-Hans": None,
|
||||
"zh-Hant": None,
|
||||
"ja": None,
|
||||
"other": []
|
||||
}
|
||||
for title in titles:
|
||||
if title["type"] == "main":
|
||||
all_title_info["main"] = title.string
|
||||
elif title["type"] == "official":
|
||||
if title["xml:lang"] in ["en", "zh-Hant", "zh-Hans", "ja"]:
|
||||
all_title_info[title["xml:lang"]] = title.string
|
||||
else:
|
||||
break
|
||||
elif title["type"] == "synonym":
|
||||
all_title_info["other"].append(title.string)
|
||||
else:
|
||||
break
|
||||
return all_title_info
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("start")
|
||||
# 年份,季度
|
||||
id_list = (get_list(2022, 1))
|
||||
for i in id_list:
|
||||
url = f"http://api.anidb.net:9001/httpapi?request=anime&client=autobangumi&clientver=1&protover=1&aid={i}"
|
||||
req = requests.get(url)
|
||||
soup = BeautifulSoup(req.text, "xml")
|
||||
titles = soup.find("titles")["official"]
|
||||
for item in titles:
|
||||
print(item)
|
||||
ids = get_list(2022, 2)
|
||||
json = []
|
||||
for id in ids:
|
||||
data = get_title(id)
|
||||
print(data)
|
||||
time.sleep(2.5)
|
||||
json.append(data)
|
||||
json_config.save("season_summer.json", json)
|
||||
|
||||
Reference in New Issue
Block a user