Last active
October 17, 2024 05:12
-
-
Save xubai2001/f3990b22b7e16c6c26b6e505d393fe53 to your computer and use it in GitHub Desktop.
Surge script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 检查响应状态码是否是 302 | |
if ($response.status === 302) { | |
// 获取 Location 重定向的 URL | |
let locationUrl = $response.headers['Location']; | |
locationUrl =decodeURIComponent(escape(locationUrl)); | |
const jsonResult = {"url": locationUrl}; | |
$done({ | |
status: 200, // 返回 200 OK 状态码 | |
headers: { 'Content-Type': 'application/json' }, // 设置响应头为 HTML | |
body: JSON.stringify(jsonResult) | |
}); | |
} else { | |
$done({}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!name=爱读书app书源 | |
#!desc=拦截302重定向,获取音频文件url | |
[Script] | |
拦截302 = type=http-response,pattern=^http:\/\/202\.63\.172\.66:5862\/api\/ptcms\/chapterPlays\?bookID=\d+&chapterID=\d+&token=[a-f0-9]+&time=\d+$,requires-body=1,script-path=https://gist.githubusercontent.com/xubai2001/f3990b22b7e16c6c26b6e505d393fe53/raw/1f3b04bfef4ffd54fc54b3622bcecf32dc93c521/302%25E6%258B%25A6%25E6%2588%25AA.js,max-size=0,binary-body-mode=0 | |
[MITM] | |
hostname = %APPEND% 202.63.172.66:5862 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment