Rishikant181 / Rettiwt-API

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

Use it from the browser? #294

Closed laike9m closed 1 year ago

laike9m commented 1 year ago

It would be nice if this lib can be used from the browser (I only intend to fetch tweets at low frequency without using the server feature). Currently it seems impossible.

btw thanks for making this in a post-twitter-2.0 world :)

Rishikant181 commented 1 year ago

You can use if from inside a browser using the GraphQL API mode.

After starting it in the GraphQL API mode, go to localhost:{port_number}/graphql on you web browser to access the GraphiQL GUI to run queries to fetch data from Twitter. This method, however, doesn't allow you to send authenticated requests for fetching data such as followers, likes, etc.

If you want to make authenticated requests, using you account's credential, you can use a tool like Postman or Hoppscotch to make the same queries, using the GraphQL API.

laike9m commented 1 year ago

thanks. In my case, I don't need to login and guest mode is probably fine. you mean that this part can run in the browser without authentication:

image

Rishikant181 commented 1 year ago

Sorry for the late reply. My exams were going on.

https://github.com/Rishikant181/Rettiwt-API#1-graphql-server

This is probably the one you are looking for. It will work without needing to log in, and from the browser.

After setting up, go to localhost:{port_number}/graphql address on you web-browser where the server is running, and you can write queries there to fetch data.

laike9m commented 1 year ago

I see. So you always need a local server no matter what

Rishikant181 commented 1 year ago

Unfortunately, yes.

Using it without a local server requires hosting the server on an actual physical machine, which will additionally incur cost. Then there is the legalities of scraping data from a web server.

So, it's best to just setup a local server for scrap data.