Get Twitter Feed as JSON without authentication

前端 未结 8 558
难免孤独
难免孤独 2021-01-30 18:16

I wrote a small JavaScript a couple of years ago that grabbed a users (mine) most recent tweet and then parsed it out for display including links, date etc.

It used this

相关标签:
8条回答
  • 2021-01-30 18:51

    Previously the Search API was the only Twitter API that didn't require some form of OAuth. Now it does require auth.

    Twitter's Search API is acquired from a third party acquisition - they rarely support it and are seemingly unenthused that it even exists. On top of that, there are many limitations to the payload, including but not limited to a severely reduced set of key:value pairs in the JSON or XML file you get back.

    When I heard this, I was shocked. I spent a LONG time figuring out how to use the least amount of code to do a simple GET request (like displaying a timeline).

    I decided to go the OAuth route to be able to ensure a relevant payload. You need a server-side language to do this. JavaScript is visible to end users, and thus it's a bad idea to include the necessary keys and secrets in a .js file.

    I didn't want to use a big library so the answer for me was PHP and help from @Rivers' answer here. The answer below it by @lackovic10 describes how to include queries in your authentication.

    I hope this helps others save time thinking about how to go about using Twitter's API with the new OAuth requirement.

    0 讨论(0)
  • 2021-01-30 18:51

    If you're still looking for unauthenticated tweets in JSON, this should work: https://github.com/cosmocatalano/tweet-2-json

    0 讨论(0)
提交回复
热议问题