sferik / twitter-ruby

A Ruby interface to the Twitter API.
http://www.rubydoc.info/gems/twitter
MIT License
4.59k stars 1.31k forks source link

API V2.0 support #1031

Closed GuyFlenner closed 11 months ago

GuyFlenner commented 1 year ago

Hello. We used to work with V1.1, but Twitter last week deprecated this version. I red the readme file and didn't saw support for V2.0. are you planning to support it in this project ? Thanks

jkotchoff commented 1 year ago

This will work with the new OAuth2 authentication requirements from Twitter (using the less full featured but much smaller twitter_oauth2 gem): https://gist.github.com/jkotchoff/e2f5e5fa431f090ab2fb62613287dfbb

noraj commented 1 year ago

The free tier Twitter API now only allows tweet creation with API v2.0 and API v1.1 can only be used to upload media and update statuses. So unless v2.0 support is added this API will probably become obsolete.

jkotchoff commented 1 year ago

The free tier Twitter API now only allows tweet creation with API v2.0 and API v1.1 can only be used to upload media and update statuses. So unless v2.0 support is added this API will probably become obsolete.

Maybe https://github.com/sferik/twitter is the most similar gem compatible with v2.0 right now.

This issue is for the sferik/twitter gem which does NOT support Twitter API v2.0 yet. As shown in the gist above, you can talk to the new v2.0 Twitter API using the twitter_oauth2 gem instead.

jasonfine commented 1 year ago

Older applications won't support the twitter_oauth2 gem, without major version upgrades to core dependencies, as it requires rack (>= 2.1.0). So simply switching to that is not an option without considerable effort.

It would be ideal if this gem could support the API changes.

JeremiahChurch commented 1 year ago

I've looked over the API changes and they are not straight forward.

the cursoring/pagination is different but do-able. But the overall shape of the data is quite a bit different. My primary use case is 'contacts' and DMs and the 2.0 endpoints are pretty different. the friends endpoint functionally doesn't exist and the DM events is quite a bit different.

This is likely going to require quite a bit of changes either here or elsewhere

jasonfine commented 1 year ago

Ugh. Appreciate the insight

noraj commented 1 year ago

Maybe https://github.com/sferik/twitter is the most similar gem compatible with v2.0 right now.

This issue is for the sferik/twitter gem which does NOT support Twitter API v2.0 yet.

Sorry, wrong link, I meant https://github.com/julianfssen/tweetkit.

RyanTG commented 1 year ago

The free tier Twitter API now only allows tweet creation with API v2.0 and API v1.1 can only be used to upload media and update statuses. So unless v2.0 support is added this API will probably become obsolete.

I can't even update statuses anymore! Something changed around June 18. Even though their docs seem to indicate we should still be able to post. https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/overview

This seems like the end.

duplicategibberish commented 1 year ago

The free tier Twitter API now only allows tweet creation with API v2.0 and API v1.1 can only be used to upload media and update statuses. So unless v2.0 support is added this API will probably become obsolete.

I can't even update statuses anymore! Something changed around June 18. Even though their docs seem to indicate we should still be able to post. https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/overview

This seems like the end.

If all you're doing is status updates, you can still authenticate with Oauth1 using the oauth gem, and call the v2 API using the Net::HTTP library. This worked for us to replace our usage of the gem's Twitter::REST::Client#update method. https://gist.github.com/duplicategibberish/0555c8f98094782f196840c3df7381a8

noraj commented 11 months ago

https://github.com/sferik/twitter/commit/154e66b3655b41226ca8b6cbf52e2866a9e5b2d0

https://sferik.github.io/x-ruby/

https://github.com/sferik/x-ruby