-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
31 lines (28 loc) · 977 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const puppeteer = require("puppeteer");
const a = process.argv[2];
const fs = require("fs");
const { updateBotActionList } = require("./utils");
const fetch = require("node-fetch");
// updateBotActionList("DaisyMo26021147", "allen");
(async () => {
const browser = await puppeteer.launch({
headless: false,
args: [`--proxy-server=https=23.236.168.217:8765`],
});
const page = await browser.newPage();
const filePath = `./cookies/monica_twain.json`;
if (fs.existsSync(filePath)) {
// If file exist load the cookies
const cookiesString = fs.readFileSync(filePath);
const parsedCookies = JSON.parse(cookiesString);
if (parsedCookies.length !== 0) {
for (let cookie of parsedCookies) {
await page.setCookie(cookie);
}
}
}
await page.goto("https://www.twitter.com");
// other actions...
// await browser.close();
console.log("success");
})();