mirror of https://github.com/NobyDa/Script.git
Adapt to new version bahamut API.
This commit is contained in:
parent
503bf08e9d
commit
97504925bb
|
@ -19,11 +19,17 @@ runs().catch((err) => {
|
|||
}));
|
||||
|
||||
async function runs() {
|
||||
if (req.url.includes('token.php') && rsp.ad) {
|
||||
rsp.ad.minor = [];
|
||||
rsp.ad.major = [];
|
||||
if (req.url.includes('token.php')) {
|
||||
if (rsp.ad) {
|
||||
rsp.ad.minor = [];
|
||||
rsp.ad.major = [];
|
||||
}
|
||||
if (rsp.data && rsp.data.ad) {
|
||||
rsp.data.ad.minor = [];
|
||||
rsp.data.ad.major = [];
|
||||
}
|
||||
}
|
||||
if (req.url.includes('m3u8.php') && rsp.message) {
|
||||
if (req.url.includes('m3u8.php') && (rsp.message || rsp.error)) {
|
||||
await adURL('');
|
||||
await new Promise(r => setTimeout(r, 25000));
|
||||
await adURL('end');
|
||||
|
@ -34,7 +40,7 @@ async function runs() {
|
|||
function adURL(str) {
|
||||
return new Promise((res) => {
|
||||
get({
|
||||
url: `https://api.gamer.com.tw/mobile_app/anime/v1/stat_ad.php?ad=${str}&schedule=0&sn=${req.url.split(/sn=(\d+)/)[1]}`,
|
||||
url: `https://api.gamer.com.tw/mobile_app/anime/v1/stat_ad.php?ad=${str}&schedule=0&sn=${req.url.split(/sn=(\d+)/i)[1]}`,
|
||||
headers: req.headers
|
||||
}, (err, resp, data) => res())
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue