|
发表于
2025-8-18 23:52:20
|
显示全部楼层
感谢,用大佬的两个库成功解决了,写了个触发频繁,间隔1秒自动重试的脚本 
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 2025-08-17
// @description try to take over the world!
// @author You
// @match https://leetcode.cn/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode.cn
// @grant none
// @require https://scriptcat.org/lib/637/1.4.8/ajaxHooker.js
// @require https://scriptcat.org/lib/513/2.1.0/ElementGetter.js
// ==/UserScript==
(function() {
'use strict';
ajaxHooker.protect();
ajaxHooker.filter([
{type: 'fetch', url: 'interpret_solution', method: 'POST'},
]);
ajaxHooker.hook(req => {
req.response = res => {
if (res.status === 429) {
elmGetter.get('button[data-e2e-locator="console-run-button"]').then(btn => {
setTimeout(() => {
console.log('click run btn');
btn.click();
}, 1000);
});
}
};
});
})(); |
|