Scraper.login doesn't work
kws1207 opened this issue · 2 comments
kws1207 commented
Tried below code:
import { Scraper } from "@the-convocation/twitter-scraper";
import { configDotenv } from "dotenv";
configDotenv();
const scraper = new Scraper();
(async () => {
await scraper.login(
process.env.TWITTER_USERNAME || "",
process.env.TWITTER_PASSWORD || ""
);
})();
Got below error:
/Users/kws/projects/twitter-scraper-test/node_modules/@the-convocation/twitter-scraper/dist/auth-user.js:85
throw new Error(`Unknown subtask ${next.subtask.subtask_id}`);
^
Error: Unknown subtask LoginEnterAlternateIdentifierSubtask
at TwitterUserAuth.login (/Users/kws/projects/twitter-scraper-test/node_modules/@the-convocation/twitter-scraper/dist/auth-user.js:85:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Scraper.login (/Users/kws/projects/twitter-scraper-test/node_modules/@the-convocation/twitter-scraper/dist/scraper.js:282:9)
at async file:///Users/kws/projects/twitter-scraper-test/index.js:8:3
Minimum reproducible example: https://github.com/kws1207/twitter-scraper-test
Maybe it could be related to this commit.
wik3d commented
Hey @kws1207, This error is a result of Twitter detecting suspicious login activity with your account, and they require you to input your email as an additional piece of info to prove it's you.
I've pushed a fix to my fork of this repo, and I hope I have also opened a pull request and hope it will be validated soon.
My fork: https://github.com/wik3d/twitter-scraper/tree/handled-new-error
The fix I pushed: main...wik3d:twitter-scraper:handled-new-error