kheina-com / Blue-Blocker

Blocks all Twitter Blue verified users on twitter.com
Mozilla Public License 2.0
326 stars 29 forks source link

Block Queue Import by UserId #200

Closed roland-detterbeck closed 11 months ago

roland-detterbeck commented 11 months ago

Hi,

I wanted to import a blocklist but I only have the users ids, not their screen name.

Currently the import ignores the user_id in the json and blocks by screen name.

Can you fix this or is there an easy way to bulk fetch screen names for ids?

Thanks!

kheina commented 11 months ago

hey roland, the only metric needed for blocking is the user_id, it is hard required. the others are needed for the import, but not needed to actually send the block request. if you want, you can make a script to convert the list that you have into a json matching the BlockUser[] definition in the import dialogue and it should work

edit: the reason the other data points are needed are for historical reasons. the name, screen_name, and reason are all recorded on the history page when a user is blocked

roland-detterbeck commented 11 months ago

hi, i imported a json like this: { user_id: USER_ID_OF_THE_USER, user: { name: SOME_DUMMY_STRING, screen_name: SCREEN_NAME_OF_ANOTHER_USER }, reason: 0 } and the addon blocked "ANOTHER_USER" not "THE_USER". what am i missing? :)

kheina commented 11 months ago

here is the code that actually performs the block:

https://github.com/kheina-com/Blue-Blocker/blob/f6db6561f89b8f3c29a9a181b6d81534208eab09/src/shared.ts#L255-L350

user_id is the only value that's actually used in the block request via the api. user.name and user.screen_name are only used for reporting and history. they are not used in the actual request, but are rather what are displayed in the "blocked X user" popup and the history page. they are purely for your own records.

if you'd like, you can test this bychecking which of the users in your example were blocked. was the actual owner of SCREEN_NAME_OF_ANOTHER_USER blocked or was in the account of USER_ID_OF_THE_USER?

roland-detterbeck commented 11 months ago

the owner of the screen name got blocked.

kheina commented 11 months ago

that user must have been blocked previously or for different reasons then. you may want to check your block history.

I just double checked, both in the code and by running a test with the attached json of elon musk's user id and jesse cox's (a youtuber I enjoy and was watching) name and handle and elon was blocked. idk who is in your block list or how you're checking who is being blocked, but you may want to double check. or else just use garbage data for your name and handle so you know it's not a real account.

(apparently you can't attach json files)

[
    {
        "user_id": "44196397",
        "user": {
            "name": "Jesse Cox",
            "screen_name": "JesseCox"
        },
        "reason": 0
    }
]
roland-detterbeck commented 11 months ago

ok i will check again later after my block queue is finished ;)

roland-detterbeck commented 11 months ago

ok, it works like it should. the user gets blocked by id. looks like the wrong username in the history tricked me.

kheina commented 11 months ago

if I remember right, the block api and the mute api both return the user object from the request, so it might be worthwhile making an issue to use the api response for the history rather than the name and handle from the queue