mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-11 22:50:45 +08:00
Compare commits
3 Commits
47d05dc37b
...
f1cf1f0eb8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1cf1f0eb8 | ||
|
|
c90262485f | ||
|
|
7d8701db0a |
@ -524,11 +524,16 @@
|
||||
changeShareurl(task) {
|
||||
if (!task.shareurl)
|
||||
return;
|
||||
this.$set(task, "shareurl_ban", undefined);
|
||||
// 从URL中提取任务名
|
||||
const matches = decodeURIComponent(task.shareurl).match(/\/(\w{32})-([^\/]+)$/);
|
||||
if (matches) {
|
||||
task.taskname = task.taskname == "" ? matches[2] : task.taskname;
|
||||
task.savepath = task.savepath.replace(/TASKNAME/g, matches[2]);
|
||||
try {
|
||||
const matches = decodeURIComponent(task.shareurl).match(/\/(\w{32})-([^\/]+)$/);
|
||||
if (matches) {
|
||||
task.taskname = task.taskname == "" ? matches[2] : task.taskname;
|
||||
task.savepath = task.savepath.replace(/TASKNAME/g, matches[2]);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error decodeURIComponent:", e);
|
||||
}
|
||||
// 从分享中提取任务名
|
||||
axios.get('/get_share_detail', { params: { shareurl: task.shareurl } })
|
||||
|
||||
@ -185,13 +185,13 @@ class Quark:
|
||||
try:
|
||||
response = requests.request(method, url, headers=headers, **kwargs)
|
||||
# print(f"{response.text}")
|
||||
response.raise_for_status() # 检查请求是否成功
|
||||
# response.raise_for_status() # 检查请求是否成功,但返回非200也会抛出异常
|
||||
return response
|
||||
except Exception as e:
|
||||
print(f"_send_request error:\n{e}")
|
||||
fake_response = requests.Response()
|
||||
fake_response.status_code = 500
|
||||
fake_response._content = b'{"error": 1}'
|
||||
fake_response._content = b'{"status": 500, "message": "request error"}'
|
||||
return fake_response
|
||||
|
||||
def init(self):
|
||||
@ -263,6 +263,7 @@ class Quark:
|
||||
response = self._send_request(
|
||||
"POST", url, json=payload, params=querystring
|
||||
).json()
|
||||
print(response)
|
||||
if response.get("status") == 200:
|
||||
return True, response["data"]["stoken"]
|
||||
else:
|
||||
@ -381,7 +382,7 @@ class Quark:
|
||||
"__dt": int(random.uniform(1, 5) * 60 * 1000),
|
||||
"__t": datetime.now().timestamp(),
|
||||
}
|
||||
response = requests.request("GET", url, params=querystring).json()
|
||||
response = self._send_request("GET", url, params=querystring).json()
|
||||
if response["data"]["status"] != 0:
|
||||
if retry_index > 0:
|
||||
print()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user