Skip to content

Commit

Permalink
feat: 增加支付宝
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Oct 1, 2017
1 parent 09adc57 commit 6a3ce31
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
53 changes: 53 additions & 0 deletions app/providers/alipay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const puppeteer = require('puppeteer');
const Provider = require('../provider');

const config = require('../config');

const utils = require('../utils');

class AliPayProvider extends Provider {
constructor() {
super();
}
async resolve(phone) {
const URL = `https://memberprod.alipay.com/account/reg/index.htm`;
const browser = await puppeteer.launch({
headless: config.isProduction
});

const page = await browser.newPage();

await page.goto(URL, {
networkIdleTimeout: 5000,
waitUntil: 'networkidle',
timeout: 3000000
});

await page.deleteCookie();

await utils.sleep(2000);

const [$mobile, $codeInput, $submit] = await Promise.all([
page.$('#J-accName'),
page.$('#J-mobCode'),
page.$('#J-resend-mobile>button')
]);

await utils.sleep(2000);

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

await $codeInput.click();

await page.type('123456', { delay: 100 });

await $submit.click();

await utils.sleep(2000);

await browser.close();
}
}

module.exports = AliPayProvider;
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const App = require('./app/app');
const QQProvider = require('./app/providers/qq');
const AliyunProvider = require('./app/providers/aliyun');
const AliPayProvider = require('./app/providers/alipay');
const TaobaoProvider = require('./app/providers/taobao');
const JuheProvider = require('./app/providers/juhe');
const XiangRiKuiProvider = require('./app/providers/xiangrikui');
Expand All @@ -13,4 +14,5 @@ new App(13377175342)
.provider(JuheProvider)
.provider(XiangRiKuiProvider)
.provider(YoukuProvider)
.provider(AliPayProvider)
.bootstrap();

0 comments on commit 6a3ce31

Please sign in to comment.