Skip to content

hedgeyedev/fake_twitter_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Purpose

Since twitter started charging for API, you can’t do much with a free twitter. This exists to provide something akin to the old twitter api to provide a list of tweets in the twitter JSON format

How to use as server

  • bundle install
  • ruby main.rb # optional -p <port number> as a sinatra app it defaults to 4567

If you need CORS support you can pass a port number via –cors to allow requests from localhost:<port>

  • ruby main.rb –cors 3000

How to consume

  • if you hit this url http://localhost:4567/1.1/statuses/status.json?count=3 # note that count can be supplied, defaults to 30
  • you get json like this
[{"text":"Went to let us again and boat for secrecy.","truncated":true,"in_reply_to_user_id":null,"in_reply_to_status_id":null,"favorited":false,"source":"<a href=\"http://twitter.com/\" rel=\"nofollow\"><a href=\"http://www.hootsuite.com\" rel=\"nofollow\">HootSuite</a></a>","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"id_str":"595bacb270604b7036a9","entities":{"user_mentions":[],"urls":[],"hashtags":[]},"contributors":null,"retweeted":false,"in_reply_to_user_id_str":null,"place":null,"retweet_count":2,"created_at":"Wed Nov 15 19:40:20 +0000 2023","retweeted_status":null,"user":{"notifications":null,"profile_use_background_image":true,"statuses_count":201,"profile_background_color":"C0DEED","followers_count":405,"profile_image_url":"https://picsum.photos/id/184/50/50","listed_count":6,"profile_background_image_url":"http://example.com/bg_image.jpg","description":"Sample description","screen_name":"samantha_sophia","default_profile":true,"verified":false,"time_zone":"UTC","profile_text_color":"333333","is_translator":false,"profile_sidebar_fill_color":"DDEEF6","location":"Sample location","id_str":"897a0d8611b19740","default_profile_image":false,"profile_background_tile":false,"lang":"en","friends_count":112,"protected":false,"favourites_count":5,"created_at":"Wed Nov 15 19:40:20 +0000 2023","profile_link_color":"0084B4","name":"Sample User","show_all_inline_media":false,"follow_request_sent":null,"geo_enabled":false,"profile_sidebar_border_color":"C0DEED","url":"http://twitter.com/samantha_sophia","id":33692,"contributors_enabled":false,"following":null,"utc_offset":-18000},"id":57136,"coordinates":null,"geo":null},{"text":"And I have no help produce results to well out of the Indians settled.","truncated":false,"in_reply_to_user_id":null,"in_reply_to_status_id":null,"favorited":false,"source":"<a href=\"http://twitter.com/\" rel=\"nofollow\"><a href=\"http://twitter.com/\" rel=\"nofollow\">Twitter for Android</a></a>","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"id_str":"195618aaf24e93a7254d","entities":{"user_mentions":[],"urls":[],"hashtags":[]},"contributors":null,"retweeted":false,"in_reply_to_user_id_str":null,"place":null,"retweet_count":1,"created_at":"Wed Nov 15 19:39:41 +0000 2023","retweeted_status":null,"user":{"notifications":null,"profile_use_background_image":true,"statuses_count":193,"profile_background_color":"C0DEED","followers_count":912,"profile_image_url":"https://picsum.photos/id/42/50/50","listed_count":7,"profile_background_image_url":"http://example.com/bg_image.jpg","description":"Sample description","screen_name":"crew","default_profile":true,"verified":false,"time_zone":"UTC","profile_text_color":"333333","is_translator":false,"profile_sidebar_fill_color":"DDEEF6","location":"Sample location","id_str":"a6d48ee86a73474c","default_profile_image":false,"profile_background_tile":false,"lang":"en","friends_count":24,"protected":false,"favourites_count":19,"created_at":"Wed Nov 15 19:39:41 +0000 2023","profile_link_color":"0084B4","name":"Sample User","show_all_inline_media":false,"follow_request_sent":null,"geo_enabled":false,"profile_sidebar_border_color":"C0DEED","url":"http://twitter.com/crew","id":77872,"contributors_enabled":false,"following":null,"utc_offset":25200},"id":66475,"coordinates":null,"geo":null},{"text":"And Burtons.","truncated":true,"in_reply_to_user_id":null,"in_reply_to_status_id":null,"favorited":false,"source":"<a href=\"http://twitter.com/\" rel=\"nofollow\"><a href=\"http://twitter.com/\" rel=\"nofollow\">Twitter for iPhone</a></a>","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"id_str":"1abfadedde12467fff4e","entities":{"user_mentions":[],"urls":[],"hashtags":[]},"contributors":null,"retweeted":false,"in_reply_to_user_id_str":null,"place":null,"retweet_count":6,"created_at":"Wed Nov 15 19:39:25 +0000 2023","retweeted_status":null,"user":{"notifications":null,"profile_use_background_image":true,"statuses_count":101,"profile_background_color":"C0DEED","followers_count":128,"profile_image_url":"https://picsum.photos/id/85/50/50","listed_count":7,"profile_background_image_url":"http://example.com/bg_image.jpg","description":"Sample description","screen_name":"paul_green","default_profile":true,"verified":false,"time_zone":"UTC","profile_text_color":"333333","is_translator":false,"profile_sidebar_fill_color":"DDEEF6","location":"Sample location","id_str":"2b58c0d532bd4631","default_profile_image":false,"profile_background_tile":false,"lang":"en","friends_count":130,"protected":false,"favourites_count":0,"created_at":"Wed Nov 15 19:39:25 +0000 2023","profile_link_color":"0084B4","name":"Sample User","show_all_inline_media":false,"follow_request_sent":null,"geo_enabled":false,"profile_sidebar_border_color":"C0DEED","url":"http://twitter.com/paul_green","id":27218,"contributors_enabled":false,"following":null,"utc_offset":32400},"id":99056,"coordinates":null,"geo":null}]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages