Rishikant181 / Rettiwt-API

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

How to use rettiwt.tweet.stream and I can't receive tweets #538

Closed spencer17x closed 1 month ago

spencer17x commented 1 month ago

Such as title

Rishikant181 commented 1 month ago

Did you try the example?

spencer17x commented 1 month ago

Yeah, that's what I used as an example

spencer17x commented 1 month ago

If I want to get relevant tweets in real time, can I use this api

Rishikant181 commented 1 month ago

What the stream method does is, given a polling rate, it checks if any new tweets are made, if made, it returns the tweets. Note that a tweet is returned only if it's a new one starting from the time the streaming was started.

If I want to get relevant tweets in real time, can I use this api

So yes, you can. You just need to pass a filter to get the relevant tweets and set a desired polling rate. Here are all the filters available.

spencer17x commented 1 month ago

Do I need a polling request? Or the request will always return the latest tweet

Rishikant181 commented 1 month ago

Do I need a polling request?

The method implicitly does the polling. You just need to call it and iterate over the returned AsyncGenerator. The example given shows how to do it. The only thing you need to change is instead of console.log, do whatever you want with the received tweets.

Or the request will always return the latest tweet

The request will always return the most recent tweet that was made after the polling started.