Giter Club home page Giter Club logo

Comments (6)

smaeda-ks avatar smaeda-ks commented on June 14, 2024 2

This will be fixed in the coming new version:
#161

from twurl.

andypiper avatar andypiper commented on June 14, 2024

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.

from twurl.

balupton avatar balupton commented on June 14, 2024

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

from twurl.

balupton avatar balupton commented on June 14, 2024

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.

from twurl.

andypiper avatar andypiper commented on June 14, 2024

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.

from twurl.

balupton avatar balupton commented on June 14, 2024

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 [email protected] 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.

from twurl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.