Skip to content

Commit

Permalink
feat(google): runway
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangsx committed Aug 30, 2024
1 parent a419200 commit f253a4d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions model/runway/child.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '../../utils/proxyAgent';
import { Page, Protocol } from 'puppeteer';
import moment from 'moment';
import { loginGoogle } from '../../utils/puppeteer';
import { loginGoogle, loginGoogleNew } from '../../utils/puppeteer';
import {
ComError,
downloadAndUploadCDN,
Expand Down Expand Up @@ -144,20 +144,15 @@ export class Child extends ComChild<Account> {
30 * 1000,
);
page.browser().on('targetcreated', async (target) => {
clearTimeout(delay);
try {
const newPage = await target.page();
if (newPage) {
console.log('新窗口/标签被创建');
await newPage.waitForTimeout(1000); // 等待一会让页面加载
console.log(await newPage.url()); // 输出新窗口的URL
await loginGoogle(
newPage,
this.info.email,
this.info.password,
this.info.recovery,
);
await loginGoogleNew(newPage, this.info);
resolve(null);
clearTimeout(delay);
}
} catch (e) {
reject(e);
Expand All @@ -170,6 +165,7 @@ export class Child extends ComChild<Account> {
await this.saveToken();
await this.saveTeamID();
await this.saveUA();
await sleep(60 * 60 * 1000);
await page.browser().close();
} else if (!this.info.token || !this.info.ua || !this.info.proxy) {
page = await CreateNewPage(
Expand Down

0 comments on commit f253a4d

Please sign in to comment.