Closed balupton closed 1 year ago
Super odd. I expect this is going to be a trivial and annoying question, just want to confirm that the ID is accurate in the post, right - you’ve literally lifted it from the original URL to the twurl deletion?
Can I also ask you what version of Ruby you are on, please.
Super odd. I expect this is going to be a trivial and annoying question, just want to confirm that the ID is accurate in the post, right - you’ve literally lifted it from the original URL to the twurl deletion?
Yep.
Deleting https://twitter.com/balupton/status/1348265755771506690 manually:
> twurl -X POST '/1.1/statuses/destroy/1348265755771506690.json'
{"errors":[{"message":"Your credentials do not allow access to this resource","code":220}]}⏎
Deleting programatically:
> twurl /1.1/statuses/user_timeline.json | jq -r '.[].id_str' | xargs -I {} -t twurl -X POST '/1.1/statuses/destroy/{}.json'
twurl -X POST /1.1/statuses/destroy/1348265755771506690.json
{"errors":[{"message":"Your credentials do not allow access to this resource","code":220}]}⏎
Can I also ask you what version of Ruby you are on, please.
> ruby --version
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
> twurl --version
0.9.6
> uname -a
Darwin redacted 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64
As an aside, it seems that jq
, json
, and node.js round 1348265755771506690
up to 1348265755771506700
> echo '[{"id": 1348265755771506690}]' | jq '.[].id'
1348265755771506700
> echo '[{"id": 1348265755771506690}]' | json -a id
1348265755771506700
> node
Welcome to Node.js v15.5.1.
Type ".help" for more information.
> console.log(1348265755771506690)
1348265755771506700
So using id_str
is necessary when using such tooling:
> twurl /1.1/statuses/user_timeline.json | jq '.[].id_str'
"1348265755771506690"
And if they are using jq
, they also have to do the -r
flag if they are expectign to pass it to other things:
> twurl /1.1/statuses/user_timeline.json | jq -r '.[].id_str'
1348265755771506690
This gotcha would be worthwhile specifying in the readme as twurl is a CLI tool so people are probably using it such a fashion.
Yeah, I agree about the doc issue. jq is doing that partly as JavaScript has issues dealing with large numbers. https://developer.twitter.com/en/docs/twitter-ids
At the moment I strongly suspect this issue is related to twurl not working well with Ruby v3, rather than the ID and large numbers thing. I don’t currently have a lot of time to spend on this, but it is very much on the radar.
At the moment I strongly suspect this issue is related to twurl not working well with Ruby v3, rather than the ID and large numbers thing. I don’t currently have a lot of time to spend on this, but it is very much on the radar.
Tried with Ruby 2.7
> ruby --version
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin20]
> twurl /1.1/statuses/user_timeline.json | jq -r '.[].id_str' | xargs -I {} -t twurl -X POST '/1.1/statuses/destroy/{}.json'
twurl -X POST /1.1/statuses/destroy/1348265755771506690.json
{"created_at":"Sun Jan 10 13:49:40 +0000 2021","id":1348265755771506690,"id_str":"1348265755771506690","text":"test dorothy deletion script","truncated":false,"entities":{"hashtags":[],"symbols":[],"user_mentions":[],"urls":[]},"source":"\u003ca href=\"https:\/\/mobile.twitter.com\" rel=\"nofollow\"\u003eTwitter Web App\u003c\/a\u003e","in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":49753661,"id_str":"49753661","name":"Benjamin Lupton","screen_name":"balupton","location":"","description":"Founder of @BevryMe\nPlease email me b@lupton.cc instead of tweeting me.","url":"https:\/\/t.co\/aimVjZP7Hj","entities":{"url":{"urls":[{"url":"https:\/\/t.co\/aimVjZP7Hj","expanded_url":"https:\/\/balupton.com","display_url":"balupton.com","indices":[0,23]}]},"description":{"urls":[]}},"protected":false,"followers_count":2110,"friends_count":1,"listed_count":151,"created_at":"Mon Jun 22 20:27:41 +0000 2009","favourites_count":10888,"utc_offset":null,"time_zone":null,"geo_enabled":false,"verified":false,"statuses_count":35,"lang":null,"contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"FFFFFF","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/1187147174934544384\/KQvB1_uc_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1187147174934544384\/KQvB1_uc_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/49753661\/1571910906","profile_link_color":"03718A","profile_sidebar_border_color":"1BB32F","profile_sidebar_fill_color":"CCFFD8","profile_text_color":"293C42","profile_use_background_image":true,"has_extended_profile":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false,"translator_type":"none"},"geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"retweet_count":0,"favorite_count":0,"favorited":false,"retweeted":false,"lang":"en"}⏎
> curl -s -o /dev/null -w "%{http_code}" https://twitter.com/balupton/status/1348265755771506690
400⏎
Success.
This will be fixed in the coming new version: https://github.com/twitter/twurl/pull/161
I've created my app:
It has all the permissions:
It has fresh keys generated on:
I do:
Open the url:
And authorize successfully:
I create a tweet via the twitter web app:
https://twitter.com/balupton/status/1348265755771506690
I attempt to delete the tweet via twurl where it fails:
Hence why I am here.