Rishikant181 / Rettiwt-API

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

Wanting tweets from specific days #528

Closed 14cnewman closed 7 months ago

14cnewman commented 7 months ago

Hi! Apologies if this is somewhere in your notes, but I want to pull tweets from specific days- using the createdAt id maybe? But can't seem to figure out how. Thank you for your help!

Rishikant181 commented 7 months ago

Yup you can use the startDate and endDate parameters for filtering while searching for tweets as follows:

const rettiwt = new Rettiwt({ apiKey: API_KEY, logging: true });

const tweets = await rettiwt.tweet.search({
    fromUsers: ['user1'],
    startDate: new Date('2024-04-24'),
    endDate: new Date('2024-04-25')
}, 10);

The above snippet will fetch tweet from 'user1' from 2024-04-24 to 2024-04-25. For fetching tweets from a single day, you may set the startDate and endDate to be same.

14cnewman commented 7 months ago

Thank you so much!!! :D