Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Tweets API is returning 404 #45

Open
12joan opened this issue Aug 15, 2023 · 6 comments
Open

User Tweets API is returning 404 #45

12joan opened this issue Aug 15, 2023 · 6 comments
Labels
bug Something isn't working outage twitter

Comments

@12joan
Copy link
Owner

12joan commented Aug 15, 2023

Probably related to zedeus/nitter#983

The API request to fetch Tweets for a given user is returning a 404 status and no response body.

twitter-client-web-1    | Using credentials: developer.twitter.com
twitter-client-web-1    | Guest token: Cache hit
twitter-client-web-1    | User ID: Cache hit
twitter-client-web-1    | Response {
twitter-client-web-1    |   [Symbol(realm)]: null,
twitter-client-web-1    |   [Symbol(state)]: {
twitter-client-web-1    |     aborted: false,
twitter-client-web-1    |     rangeRequested: false,
twitter-client-web-1    |     timingAllowPassed: true,
twitter-client-web-1    |     requestIncludesCredentials: true,
twitter-client-web-1    |     type: 'default',
twitter-client-web-1    |     status: 404,
twitter-client-web-1    |     timingInfo: {
twitter-client-web-1    |       startTime: 6269.856628000736,
twitter-client-web-1    |       redirectStartTime: 0,
twitter-client-web-1    |       redirectEndTime: 0,
twitter-client-web-1    |       postRedirectStartTime: 6269.856628000736,
twitter-client-web-1    |       finalServiceWorkerStartTime: 0,
twitter-client-web-1    |       finalNetworkResponseStartTime: 0,
twitter-client-web-1    |       finalNetworkRequestStartTime: 0,
twitter-client-web-1    |       endTime: 0,
twitter-client-web-1    |       encodedBodySize: 0,
twitter-client-web-1    |       decodedBodySize: 0,
twitter-client-web-1    |       finalConnectionTimingInfo: null
twitter-client-web-1    |     },
twitter-client-web-1    |     cacheState: '',
twitter-client-web-1    |     statusText: 'Not Found',
twitter-client-web-1    |     headersList: HeadersList {
twitter-client-web-1    |       cookies: [Array],
twitter-client-web-1    |       [Symbol(headers map)]: [Map],
twitter-client-web-1    |       [Symbol(headers map sorted)]: null
twitter-client-web-1    |     },
twitter-client-web-1    |     urlList: [ URL {} ],
twitter-client-web-1    |     body: { stream: undefined }
twitter-client-web-1    |   },
twitter-client-web-1    |   [Symbol(headers)]: HeadersList {
twitter-client-web-1    |     cookies: [
twitter-client-web-1    |       'guest_id=v1%3A169208846826427247; Max-Age=34214400; Expires=Sat, 14 Sep 2024 08:34:28 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None'
twitter-client-web-1    |     ],
twitter-client-web-1    |     [Symbol(headers map)]: Map(13) {
twitter-client-web-1    |       'date' => [Object],
twitter-client-web-1    |       'perf' => [Object],
twitter-client-web-1    |       'server' => [Object],
twitter-client-web-1    |       'set-cookie' => [Object],
twitter-client-web-1    |       'cache-control' => [Object],
twitter-client-web-1    |       'content-length' => [Object],
twitter-client-web-1    |       'x-transaction-id' => [Object],
twitter-client-web-1    |       'x-rate-limit-limit' => [Object],
twitter-client-web-1    |       'x-rate-limit-reset' => [Object],
twitter-client-web-1    |       'x-rate-limit-remaining' => [Object],
twitter-client-web-1    |       'strict-transport-security' => [Object],
twitter-client-web-1    |       'x-response-time' => [Object],
twitter-client-web-1    |       'x-connection-hash' => [Object]
twitter-client-web-1    |     },
twitter-client-web-1    |     [Symbol(headers map sorted)]: null
twitter-client-web-1    |   }
twitter-client-web-1    | }
@12joan 12joan added bug Something isn't working twitter outage labels Aug 15, 2023
@us3r1d
Copy link
Contributor

us3r1d commented Aug 18, 2023

Nitter has a possible solution: zedeus/nitter#983 (comment)

I don't have any recent experience with Twitter's API, so I don't grok the details; do you think it's something this twitter-client could pursue?

@12joan
Copy link
Owner Author

12joan commented Aug 18, 2023

I've been keeping an eye on that issue thread.

I don't have any more experience with Twitter's internal APIs than you do (and possibly a lot less than some people who might be reading this), so I wouldn't know how to implement that solution myself. Once the specific API endpoints are shared publically, I can adapt it to JavaScript.

We might be able to make twitter-client interoperable with the tool for fetching guest credentials via proxies once that's released, configurable with a URL in the env variables or something. As a fallback for low-traffic clients, we can also include code to fetch credentials directly from Twitter (unproxied).

If anyone reading this knows how to implement the solution without waiting for Nitter, let us know and we can collaborate on an implementation.

@12joan
Copy link
Owner Author

12joan commented Aug 20, 2023

This Nitter commit contains information on how to use guest accounts instead of guest tokens to access Twitter APIs. What we're still missing is concrete information on how to generate guest accounts programatically.

Here's the Nitter PR to subscribe to for updates: zedeus/nitter#985

If anyone wants to start working on this, remember that Nitter is AGPL-3.0 and we're public domain, so we can't use any copyrightable information from Nitter. (Nitter doesn't hold the copyright to Twitter's API interface, so this is fair game. Likewise, the general algorithm for interacting with Twitter's API doesn't belong to Nitter, but Nitter's implementation details do.)

@us3r1d
Copy link
Contributor

us3r1d commented Nov 9, 2023

Nitter sites can get guest accounts from a service that was set up for Nitter hosts at https://twitterminator.x86-64-unknown-linux-gnu.zip; I just re-activated my Nitter instance using that and it's working.

I really want to switch back to using this app to backend my Mastodon gateway, though; it's much more lightweight and the formatting of the posts is much better. :-)

@12joan
Copy link
Owner Author

12joan commented Nov 9, 2023

That looks like a really nice service for fetching guest accounts, especially for people like yourself who already have it configured for a Nitter instance.

I want 12joan/twitter-client to be as flexible as possible with regard to sourcing guest accounts. I think the most extensible solution would be to expose an environment variable GET_GUEST_ACCOUNTS_CMD that can be populated, for example, as cat guest_accounts.jsonl or curl https://twitterminator.x86-64-unknown-linux-gnu.zip/download?[...]. Any shell command that outputs jsonl data to stdout.

Currently, I don't have any easy way of getting access to guest accounts to test with, nor do I have much time to spend on this at the moment. @us3r1d Are you able to adapt 12joan/twitter-client for compatibility with guest accounts, and also to add the environment variable described above?

@us3r1d
Copy link
Contributor

us3r1d commented Nov 9, 2023

Hah; I wish. I'd have done it already. :-)

The GET_GUEST_ACCOUNTS_CMD is a nifty idea for how to approach it, though.

I'll look at the source, but I probably don't have the knowledge to do this in the time I can give to it right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working outage twitter
Projects
None yet
Development

No branches or pull requests

2 participants