Rishikant181 / Rettiwt-API

A CLI tool and an API for fetching data from Twitter for free!
https://rishikant181.github.io/Rettiwt-API/
MIT License
305 stars 31 forks source link

CLI - user timeline error #455

Closed capps99 closed 4 months ago

capps99 commented 4 months ago

I have been experimenting with the CLI API, and never able to make it with the 'user' module. The only one that is working well is the 'user details' one.

rettiwt -l -k [API_KEY] user details MetroCDMX I tested all the 'tweet' module, and they work well.

So, for the rest of user [operation] I got the same error: node:internal/process/promises:289 triggerUncaughtException(err, true / fromPromise /);

Example: rettiwt -l -k [API_KEY]= user timeline MetroCDMX
[Rettiwt-API] [FETCH] [2024-02-11T19:52:59.225Z] {"resourceType":"/i/api/graphql/H8OOoI-5ZE4NxgRr8lfyWg/UserTweets","args":{"id":"MetroCDMX"}} node:internal/process/promises:289 triggerUncaughtException(err, true / fromPromise /);

=========================================================================== Update: After more analysis, I found that it's also failing on the JS implementation: rettiwt.user.timeline('MetroCDMX') .then(details => { console.log(details) }) .catch(error => { console.error(error); });

Response: DataValidationError { name: 'VALIDATION_ERROR', message: 'One or more validation errors occured. Check details', data: [ ValidationError { target: [FetchArgs], value: 'MetroCDMX', property: 'id', children: [], constraints: [Object] } ] }

===========================================================================

Environment: Node version - v20.11.0 npm version - 10.2.4

Rishikant181 commented 4 months ago

All methods of user module (except user.details) take in a user id (which is a numeric string) as input, not a username. You can see more about this error by inspecting the constraints field of the thrown error.

The error thrown in your case is a ValidationError, which means that the arguments themselves were invalid.

capps99 commented 4 months ago

Thanks, yes, it worked!! Thank you so much.

Basically, I google: "Twitter ID for a user" and was able to find it!.

This library it's amazing. Congrats!

capps99 commented 4 months ago

Worked with numeric ID.

Rishikant181 commented 4 months ago

Basically, I google: "Twitter ID for a user" and was able to find it!.

You can also fetch the user ID by using the user.details function by passing in the username. The returned response will have the user ID which you can then use to fetch timeline.