Skip to content

Commit

Permalink
feat: 添加xinnet
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Oct 2, 2017
1 parent d5a3134 commit 6264194
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
3 changes: 1 addition & 2 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class App {
await util.sleep(2000);
}
}

await util.sleep(1000 * 5);
}
async bootstrap(options = {}) {
const browser = (this.browser = await puppeteer.launch({
Expand All @@ -55,6 +53,7 @@ class App {
} else {
while (true) {
await this.run();
await util.sleep(1000 * 60);
}
}

Expand Down
41 changes: 41 additions & 0 deletions app/providers/xinnet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const Provider = require('../provider');
const utils = require('../utils');

class XinNetProvider extends Provider {
constructor() {
super();
this.url = `http://www.xinnet.com/user/user.do?method=toRegister`;
}
async resolve(ctx) {
const options = ctx.options;

const page = ctx.page;

const [$mobile, $submit] = await Promise.all([
page.$('#userMobiNumber'),
page.$('#verifyCode_href')
]);

await $mobile.click();
await page.type(options.phone, { delay: 100 });

// 按下鼠标,拖动滚动条
await page.mouse.move(460, 470);
await page.mouse.down({
button: 'left'
});

await page.mouse.move(750, 470, { steps: 10 });

await utils.sleep(1000);

await page.mouse.up({ button: 'left' });
// 松开鼠标

await utils.sleep(1000);

await $submit.click();
}
}

module.exports = XinNetProvider;
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const XiaoMiProvider = require('./app/providers/xiaomi');
const SixYueGameProvider = require('./app/providers/6yuecom');
const GaoDeProvider = require('./app/providers/gaode');
const JiuQiGeGeProvider = require('./app/providers/97gg');
const XinNetProvider = require('./app/providers/xinnet');

new App({
username: 'abc1333llgo',
Expand All @@ -31,4 +32,5 @@ new App({
.provider(SixYueGameProvider)
.provider(GaoDeProvider)
.provider(JiuQiGeGeProvider)
.provider(XinNetProvider)
.bootstrap({ autoClose: false });

0 comments on commit 6264194

Please sign in to comment.