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

Request Limit Guidance for Your Twitter Tool #506

Open
LouisStam opened this issue Apr 3, 2024 · 7 comments
Open

Request Limit Guidance for Your Twitter Tool #506

LouisStam opened this issue Apr 3, 2024 · 7 comments

Comments

@LouisStam
Copy link

Thanks for creating the Twitter reading tool on GitHub; it's been really useful. I've hit a "too_many_requests" error and was hoping you could help with a couple of things:

What's the max number of requests I can make within a certain timeframe?
Any tips on using the tool within the rate limits?

(ps: i'm only the post, not the replies etc.
thanks

@Rishikant181
Copy link
Owner

Unfortunately, I've never tested the limit myself, but I'll start with something like 1 request / second.

@MohammedShabot
Copy link

MohammedShabot commented Apr 4, 2024

@Rishikant181 I am working in NodeJs, is there a way to exclude replies from the query? I see that I can exclude it in the command line with the --exclude-replies command, but I do not know how to accomplish this in NodeJs.

I also tried to send a request every 15 seconds, then I first came across a "HTTP: TOO MANY REQUESTS" error, then followed by a "Failed to Authenticate" error. When running the script again after a few hours, the "Failed to Authenticate Error" was still there, maybe I got banned? I am now testing it on a new account, by sending a request every 55 seconds.

Thanks a lot!

@Rishikant181
Copy link
Owner

Rishikant181 commented Apr 4, 2024

I am working in NodeJs, is there a way to exclude replies from the query?

Yes you can, just set the replies property of the query while searching to false and you're good to go. Example:

import { Rettiwt } from 'rettiwt-api';

// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });

// Fetching the most recent 5 tweets from user 'user1', excluding replies
rettiwt.tweet.search({ fromUsers: ['user1'], replies: false }, 5)
.then(res => {
    console.log(res);
})
.catch(err => {
    console.log(err);
});

@MohammedShabot
Copy link

MohammedShabot commented Apr 4, 2024

@Rishikant181

Your answer was very helpful, thank you!
I have one more question I would like to ask tho:
Does limiting the amount of tweets you look at, have effect on the 'request amount'?
e.g.: If I choose to only look at the latest tweet (as you described above, with the '1'), vs if I let that out, so that it looks at all the tweets

Thank you for your help!

@Rishikant181
Copy link
Owner

Does limiting the amount of tweets you look at, have effect on the 'request amount'?

I'm afraid I didn't quite understand the question :(

@MohammedShabot
Copy link

@Rishikant181

In the code you wrote above:
// Fetching the most recent 5 tweets from user 'user1', excluding replies
rettiwt.tweet.search({ fromUsers: ['user1'], replies: false }, 5)
You fetch the last 5 tweets of the user, could this have an effect on the 'HTTP TOO MANY REQUESTS' error?

Thanks!

@Rishikant181
Copy link
Owner

No, it doesn't have an effect. Every method which Rettiwt provides for fetching or posting data, each method corresponds to sending a single request (except for Rettiwt.tweet.post, where multiple requests might be made, based on the number of media files to be included in tweet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants