Skip to content

Instantly share code, notes, and snippets.

@xfoxfu
Last active August 5, 2017 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xfoxfu/e1ca9d908ec20f9492e1477145cd5294 to your computer and use it in GitHub Desktop.
Save xfoxfu/e1ca9d908ec20f9492e1477145cd5294 to your computer and use it in GitHub Desktop.
import * as request from "request-promise";
import ServerChan = require("serverchan");
import * as fs from "fs";
const sc = new ServerChan();
const delay = (t: number) => new Promise(
(res, rej) => setTimeout(res, t)
);
(async () => {
console.log(fs.readFileSync("conf").toString());
while (true) {
const result = JSON.parse(await request({
uri: "http://wxcx.lnzsks.com/cxlnzsks/searchAdmissionInfo/SerchLqInfo.htm",
form: {
redisKey: fs.readFileSync("conf").toString().trim()
},
method: "POST"
}));
if (result.admission.xm) {
const message = `
姓名:${result.admission.xm}<br>
考生号:${result.admission.ksh}<br>
身份证号:${result.admission.sfzh}<br>
学校:${result.admission.yxmc}<br>
专业:${result.admission.zymc}<br>
`;
console.log(message);
await sc.sendMessage("您的录取信息已发布", message);
break;
} else {
console.log(`无录取信息 at ${new Date().toJSON()}`);
await delay(600000);
}
}
})().then(() => {
process.exit(0);
}).catch((err) => {
console.log(err);
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment