Skip to content

Commit

Permalink
revert cookie issue
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Sep 5, 2024
1 parent 4765def commit 8d7e387
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scraper",
"crawler"
],
"version": "0.0.10",
"version": "0.0.11",
"main": "dist/default/cjs/index.js",
"types": "./dist/types/index.d.ts",
"exports": {
Expand Down
12 changes: 2 additions & 10 deletions src/scraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,16 +567,8 @@ export class Scraper {
*/
public async setCookies(cookies: (string | Cookie)[]): Promise<void> {
const userAuth = new TwitterUserAuth(this.token, this.getAuthOptions());
const cookiesData = cookies.map((cookieData) =>
Cookie.fromJSON(JSON.stringify(cookieData)),
);

for (const cookie of cookiesData) {
if (cookie !== null) {
await userAuth.cookieJar().setCookie(cookie, twUrl);
} else {
console.error('Invalid cookie:', cookie);
}
for (const cookie of cookies) {
await userAuth.cookieJar().setCookie(cookie, twUrl);
}

this.auth = userAuth;
Expand Down

0 comments on commit 8d7e387

Please sign in to comment.