Skip to content

Instantly share code, notes, and snippets.

@Archeb
Last active June 11, 2024 05:39
Show Gist options
  • Save Archeb/fb7cec2fa3a85dbd367b7db6f8314a0a to your computer and use it in GitHub Desktop.
Save Archeb/fb7cec2fa3a85dbd367b7db6f8314a0a to your computer and use it in GitHub Desktop.
MTeam自动登录保号脚本(青龙面板用)
const puppeteer = require('puppeteer')
const { sendNotify } = require("./sendNotify");
(async () => {
// Launch the browser and open a new blank page
const browser = await puppeteer.launch({headless: "new",args: ['--no-sandbox', '--disable-setuid-sandbox']});
const page = await browser.newPage();
try{
console.log('正在打开登录页面')
// Navigate the page to a URL
await page.goto('https://kp.m-team.cc/');
// Set screen size
await page.setViewport({width: 1080, height: 1024});
await new Promise(r => setTimeout(r, 4000));
console.log("设置本地存储")
await page.evaluate(() => {
localStorage.setItem('persist:persist',JSON.stringify(这里填你从localstorage获取到的对象))
localStorage.setItem('persist:torrent',JSON.stringify(这里填你从localstorage获取到的对象))
localStorage.setItem('user.setLastUpdate',"1717831480000");
localStorage.setItem('user.setSystemMsgStatic',JSON.stringify({
"data": {
"count": "0",
"unMake": "0"
},
"lastTime": 1717831400000
}));
localStorage.setItem('user.setMsgStatic',JSON.stringify({
"data": {
"count": "0",
"unMake": "0"
},
"lastTime": 1717831400000
}));
localStorage.setItem('user.setPeerCount',JSON.stringify({
"data": {
"leecher": "1",
"seeder": "20"
},
"lastTime": 1717831490000
}));
localStorage.setItem('lastCheckTime',"1717831230000");
localStorage.setItem('user.setLastCheck4news','{"你的UID": "2024-06-05 12:00:00"}');
localStorage.setItem('apiHost','https://api2.m-team.cc/api')
localStorage.setItem('auth', '这里写入你的JWT');
});
await new Promise(r => setTimeout(r, 1000));
console.log("刷新页面")
await page.reload();
await page.goto('https://kp.m-team.cc/browse/tvshow');
console.log("获取用户信息")
const statusSelector = await page.waitForSelector("div.ant-row.ant-row-space-between.ant-row-middle.mt-2.text-sm",{timeout: 30000});
const status = await statusSelector?.evaluate(el => el.textContent);
console.log(status);
await sendNotify("*MTeam 自动登录*", status, {}, "");
console.log("访问种子页面")
await page.goto('https://kp.m-team.cc/browse/movie');
await new Promise(r => setTimeout(r, 3000));
await browser.close();
}catch(e){
await sendNotify("*MTeam 自动登录*", "炸了,错误:" + e.message, {}, "");
await browser.close();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment