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

Getting an error (`legacy` tweet undefined) when fetching some tweets #524

Closed Jeto143 closed 2 months ago

Jeto143 commented 2 months ago

Probably a duplicate of https://github.com/Rishikant181/Rettiwt-API/issues/443.

Using 2.7.0, this statement:

await rettiwt.tweet.details('1781932445375328583');

fails with the following error:

/home/jeto/dev/projects/***/node_modules/.pnpm/rettiwt-api@2.7.0/node_modules/rettiwt-api/dist/models/data/Tweet.js:22 this.createdAt = tweet.legacy.created_at; ^ TypeError: Cannot read properties of undefined (reading 'created_at') at new Tweet (/home/jeto/dev/projects/seedplantr/mansbestmeat-twitter-bot/node_modules/.pnpm/rettiwt-api@2.7.0/node_modules/rettiwt-api/dist/models/data/Tweet.js:22:39) at FetcherService.deserializeData (/home/jeto/dev/projects/seedplantr/mansbestmeat-twitter-bot/node_modules/.pnpm/rettiwt-api@2.7.0/node_modules/rettiwt-api/dist/services/internal/FetcherService.js:256:39) at TweetService. (/home/jeto/dev/projects/seedplantr/mansbestmeat-twitter-bot/node_modules/.pnpm/rettiwt-api@2.7.0/node_modules/rettiwt-api/dist/services/internal/FetcherService.js:289:49) at step (/home/jeto/dev/projects/seedplantr/mansbestmeat-twitter-bot/node_modules/.pnpm/rettiwt-api@2.7.0/node_modules/rettiwt-api/dist/services/internal/FetcherService.js:44:23) at Object.next (/home/jeto/dev/projects/seedplantr/mansbestmeat-twitter-bot/node_modules/.pnpm/rettiwt-api@2.7.0/node_modules/rettiwt-api/dist/services/internal/FetcherService.js:25:53) at fulfilled (/home/jeto/dev/projects/seedplantr/mansbestmeat-twitter-bot/node_modules/.pnpm/rettiwt-api@2.7.0/node_modules/rettiwt-api/dist/services/internal/FetcherService.js:16:58) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I'm not sure what's different about the tweet (or the account) - I've tested a couple of other quote tweets by that same account and I've encountered the same issue (very small sample though).

Rishikant181 commented 2 months ago

I think it's owing to the way the tweet details are extracted. I'll be checking it.

Rishikant181 commented 2 months ago

Turns out, the error was thrown because of a missing validation condition while de-serializing the tweets.

Please update to v2.7.1 to fix the issue.