Code Monkey home page Code Monkey logo

Comments (5)

ojwb avatar ojwb commented on June 4, 2024 1

remove_first_occurrence() does an indexOf() substring search - presumably screen_name in tweet.entities.user_mentions is lower-cased?

Probably it would be better to use the indices from that to decide what to delete instead.

from bbcmicrobot.

ojwb avatar ojwb commented on June 4, 2024 1

I'm happy to try to come up with a patch for this if that would be useful, but I think I'd really need a dump of the JSON from a sample tweet to test with (ideally one with multiple users mentioned).

from bbcmicrobot.

ojwb avatar ojwb commented on June 4, 2024 1

This continues to trip people up from time to time so would be good to fix.

@8bitkick Can you easily capture the JSON for a tweet with multiple users mentioned? I could write a patch without one, but it'd be easier with a real input to test against.

from bbcmicrobot.

8bitkick avatar 8bitkick commented on June 4, 2024

here's JSON for https://twitter.com/bbcbasicbot/status/1297027193743310851?s=20

{"created_at":"Sat Aug 22 04:25:55 +0000 2020","id":1297027193743310800,"id_str":"1297027193743310851","text":"@BBCBasicBot @BBCMicroBot @Rheolism 10 REM TEST","truncated":false,"entities":{"hashtags":[],"symbols":[],"user_mentions":[{"screen_name":"bbcbasicbot","name":"Acorn Arc (1987) - BETA BOT","id":894268101985878000,"id_str":"894268101985878016","indices":[0,12]},{"screen_name":"bbcmicrobot","name":"BBC Micro 🦉 bot","id":1225968288842182700,"id_str":"1225968288842182657","indices":[13,25]},{"screen_name":"rheolism","name":"rheolism","id":1227667955539800000,"id_str":"1227667955539800064","indices":[26,35]}],"urls":[]},"source":"<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>","in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":894268101985878000,"in_reply_to_user_id_str":"894268101985878016","in_reply_to_screen_name":"bbcbasicbot","user":{"id":894268101985878000,"id_str":"894268101985878016","name":"Acorn Arc (1987) - BETA BOT","screen_name":"bbcbasicbot","location":"","description":"10 PRINT\"Runs your tweet on the 1st ARM-based computer\"\n20 PRINT\"Emulated on a Pi 4. Try BBC BASIC V\"\n30 GOTO 10\nBy @bbcmicrobot makers. Unofficial.","url":null,"entities":{"description":{"urls":[]}}},"geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"retweet_count":0,"favorite_count":1,"favorited":false,"retweeted":false,"lang":"en"}


`

from bbcmicrobot.

8bitkick avatar 8bitkick commented on June 4, 2024

thanks sorry for the delay....

from bbcmicrobot.

Related Issues (13)

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.