Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Oct 1, 2017
1 parent ef36c2a commit 09adc57
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/providers/aliyun.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class AliYunProvider extends Provider {

await page.mouse.click(438, 433);

await utils.sleep(2000);

await browser.close();
}
}
Expand Down
4 changes: 3 additions & 1 deletion app/providers/juhe.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class JuheProvider extends Provider {

await $sendBtn.click({ button: 'left' });

// await browser.close();
await utils.sleep(2000);

await browser.close();
}
}

Expand Down
3 changes: 3 additions & 0 deletions app/providers/qq.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const puppeteer = require('puppeteer');
const Provider = require('../provider');

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

class QQProvider extends Provider {
constructor() {
Expand Down Expand Up @@ -39,6 +40,8 @@ class QQProvider extends Provider {
await page.type(phone + '', { delay: 100 });
await $send.click({ button: 'left' });

await utils.sleep(2000);

await browser.close();
}
}
Expand Down
2 changes: 2 additions & 0 deletions app/providers/taobao.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class TaobaoProvider extends Provider {

await page.mouse.click(500, 380);

await utils.sleep(2000);

await browser.close();
}
}
Expand Down
7 changes: 0 additions & 7 deletions app/providers/xiangrikui.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ class XiangRiKuiProvider extends Provider {
await $mobile.click();
await page.type(phone + '', { delay: 100 });

// 按下鼠标,拖动滚动条
await page.mouse.move(415, 325, { step: 10 });
await $slide.click(415, 325);
await page.mouse.down({
button: 'left'
});

await $submit.click({ button: 'left' });

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

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

class QQProvider extends Provider {
constructor() {
super();
}
async resolve(phone) {
const URL = `http://www.youku.com/`;
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();

const $user = await page.$('#qheader_login'); // 点击登陆

await $user.click({ button: 'left' });

await utils.sleep(2000);

const $go2register = await page.$('#YT-registeBtn'); // phone

await $go2register.click({ button: 'left' });

await utils.sleep(2000);

const [$phone, $password, $repassword, $send] = await Promise.all([
page.$('#YT-mPassport'), // phone
page.$('#YT-mRegPassword'), // password
page.$('#YT-mRepeatPwd'), // 确认密码
page.$('#YT-mGetMobileCode') // 发送验证码
]);

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

await $password.click({ button: 'left' });
await page.type(`abc123abc123`, { delay: 100 });

await $repassword.click({ button: 'left' });
await page.type(`abc123abc123`, { delay: 100 });

await $send.click({ button: 'left' });

await utils.sleep(2000);

await browser.close();
}
}

module.exports = QQProvider;
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ const AliyunProvider = require('./app/providers/aliyun');
const TaobaoProvider = require('./app/providers/taobao');
const JuheProvider = require('./app/providers/juhe');
const XiangRiKuiProvider = require('./app/providers/xiangrikui');
const YoukuProvider = require('./app/providers/youku');

new App(13377175342)
.provider(QQProvider)
.provider(AliyunProvider)
.provider(TaobaoProvider)
.provider(JuheProvider)
.provider(XiangRiKuiProvider)
.provider(YoukuProvider)
.bootstrap();

0 comments on commit 09adc57

Please sign in to comment.