Rishikant181 / Rettiwt-API

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

Stopped working - "Error: Forbidden" #297

Closed jonaslsaa closed 1 year ago

jonaslsaa commented 1 year ago

Everything has been working until now, on the 20.04. the library stopped working. I am using the NPM package using a guest session. Error: error - Error: Forbidden at FetcherService.handleHTTPError (/Users/myapp/node_modules/rettiwt-api/dist/services/util/FetcherService.js:123:19) at /Users/myapp/node_modules/rettiwt-api/dist/services/util/FetcherService.js:178:123 { page: '/api/myapp/fetch' }

My code using the library:

  const rettiwt = Rettiwt();  // seems to fail here ?
  const tweetService = rettiwt.tweets;
  const tweetFilter = new TweetFilter({fromUsers: usersToScrapeList, startDate: startOfSearch.toISOString()});
  const tweetBatch: {next: {value: string}, list: Tweet[]} = await tweetService.getTweets(tweetFilter, 18, nextCursor);
Rishikant181 commented 1 year ago

This is an issue that has come up just now. I'm working on fixing it.

Rishikant181 commented 1 year ago

Okay, I have some news.

First, twitter has blocked access to their advanced search feature for guest users. Therefore no more fetching tweets using the advanced search, without logging in.

Second (and slightly good), there is a way to circumvent this problem by fetching tweets from user's profile page instead of using the advanced search.

I'll be working on the second option.

jonaslsaa commented 1 year ago

Amazing

Second (and slightly good), there is a way to circumvent this problem by fetching tweets from user's profile page instead of using the advanced search.

I'll be working on the second option.

That sounds perfect, for my use case at least. Will the library API change?

Rishikant181 commented 1 year ago

@TheVoxcraft So the issue has been resolved (for now).

You can still older method defined here https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#getTweets to fetch tweets using a filter, but it now requires you to use credentials.

If you don't wan to use credentials, then you can use this new method defined here https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#getUserTweets. However, this method does not allow advanced tweet querying.

If you face any further issues, feel free to contact!