mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-16 09:20:43 +08:00
✨ 支持触发 alist-strm 多个配置运行
Some checks are pending
Docker Publish / build-and-push (push) Waiting to run
Some checks are pending
Docker Publish / build-and-push (push) Waiting to run
- config_id 写法 1 或 1,2(逗号分割)
This commit is contained in:
parent
4e898245f6
commit
4b13c85834
@ -18,7 +18,7 @@ class Alist_strm:
|
|||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
if kwargs:
|
if kwargs:
|
||||||
for key, value in self.default_config.items():
|
for key, _ in self.default_config.items():
|
||||||
if key in kwargs:
|
if key in kwargs:
|
||||||
setattr(self, key, kwargs[key])
|
setattr(self, key, kwargs[key])
|
||||||
else:
|
else:
|
||||||
@ -30,17 +30,23 @@ class Alist_strm:
|
|||||||
def run(self, task):
|
def run(self, task):
|
||||||
self.run_selected_configs(self.config_id)
|
self.run_selected_configs(self.config_id)
|
||||||
|
|
||||||
def get_info(self, config_id):
|
def get_info(self, config_id_str):
|
||||||
url = f"{self.url}/edit/{config_id}"
|
url = f"{self.url}/configs"
|
||||||
headers = {"Cookie": self.cookie}
|
headers = {"Cookie": self.cookie}
|
||||||
try:
|
try:
|
||||||
response = requests.request("GET", url, headers=headers)
|
response = requests.request("GET", url, headers=headers)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
html_content = response.text
|
html_content = response.text
|
||||||
# 用正则提取 config_name 的值
|
# 用正则提取 config_name 的值
|
||||||
match = re.search(r'name="config_name" value="([^"]+)"', html_content)
|
matchs = re.findall(
|
||||||
if match:
|
r'value="(\d*)">\s*<strong>名称:</strong>([^<]+)', html_content
|
||||||
config_name = match.group(1)
|
)
|
||||||
|
if matchs:
|
||||||
|
config_name = [
|
||||||
|
item[1].strip()
|
||||||
|
for item in matchs
|
||||||
|
if item[0] in config_id_str.split(",")
|
||||||
|
]
|
||||||
print(f"alist-strm配置运行: {config_name}")
|
print(f"alist-strm配置运行: {config_name}")
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user