DIYgod / RSSHub

🧡 Everything is RSSible
https://docs.rsshub.app
MIT License
33.97k stars 7.58k forks source link

Twitter route stopped working? (Username+password login) #17089

Closed D0peCrack closed 1 month ago

D0peCrack commented 1 month ago

Routes

/twitter/user/:id/:routeParams?

Full routes

twitter/user/elonmusk/readable=0&authorNameBold=0&showAuthorInTitle=1&showAuthorInDesc=0&showSymbolForRetweetAndReply=0&showRetweetTextInTitle=0&addLinkForPics=1&&heightOfPics=200

Related documentation

normal rsshub docs

What is expected?

return elon musk twitter info

What is actually happening?

Error Message: FetchError: [POST] "https://api.x.com/1.1/onboarding/task.json": 403 Forbidden

Route: /twitter/user/:id/:routeParams?

Deployment information

Self-hosted

Deployment information (for self-hosted)

No response

Additional info

Could anyone check it. 
My setup worked like 2 weeks ago. 
i signup via username and password
currently it doesnt work

This is not a duplicated issue

github-actions[bot] commented 1 month ago
Searching for maintainers:

To maintainers: if you are not willing to be disturbed, list your username in scripts/workflow/test-issue/call-maintainer.js. In this way, your username will be wrapped in an inline code block when tagged so you will not be notified.

If all routes can not be found, the issue will be closed automatically. Please use NOROUTE for a route-irrelevant issue or leave a comment if it is a mistake. 如果所有路由都无法匹配,issue 将会被自动关闭。如果 issue 和路由无关,请使用 NOROUTE 关键词,或者留下评论。我们会重新审核。

D0peCrack commented 1 month ago

and my ip is not blocked and i can sign in to my account with no problem

murichazuke commented 1 month ago

The 403 error came from AccountDuplicationCheck, and it looks like LoginEnterPassword now returns tokens. I made some changes, and the login was successful.

diff --git a/lib/routes/twitter/api/mobile-api/login.ts b/lib/routes/twitter/api/mobile-api/login.ts
index 1e4c4570f..7aceffb53 100644
--- a/lib/routes/twitter/api/mobile-api/login.ts
+++ b/lib/routes/twitter/api/mobile-api/login.ts
@@ -133,6 +133,11 @@ async function login({ username, password, authenticationSecret }) {
                     },
                 });
                 logger.debug('Twitter login 4 finished: LoginEnterPassword.');
+                for (const subtask of task3.data?.subtasks || []) {
+                    if (subtask.open_account) {
+                        return subtask.open_account;
+                    }
+                }