Greasy Fork is available in English.

Twitter media-only filter toggle.

Toggle non-media tweets on and off on the home timeline, for the power-viewer!

< Feedback on Twitter media-only filter toggle.

Review: Good - script works

§
Posted: 06-09-2024
Edited: 06-09-2024

It's working fast and stable since the update. Thank you.
However, there is an invisibility issue for Tweets that are formatted like this
https://x.com/Dear_my_0507/status/1832055981934801334
https://x.com/bbishong421/status/1832047141046665693
https://x.com/DD_HQ_talk/status/1832043380219731978
https://x.com/DD_HQ_talk/status/1832033633588371459
https://x.com/Dear_my_0507/status/1832030573457715228
In the first and last cases, they are not visible even though they contain only images
Also, In a tweet thread, the parent tweet contains only text, but the reply tweet includes media, which is not visible.

CroAuthor
§
Posted: 06-09-2024

Okay, version 0.18 fixes the quote tweets not showing up, however the first and last tweets in your examples are still broken. I'll try to figure that out soon.

§
Posted: 06-09-2024

Thank you for the very quick fix.
I don't know if this will help, but in a Tweet thread, if the parent Tweet only has text and the child Tweet has a photo, and if the parent Tweet has a photo but the child Tweet has a video, the tweets are both marked as invisible

CroAuthor
§
Posted: 06-09-2024

I think I've figured it out. The tweet structure was slightly different for some reason, and I made a more general solution to detect media properties. Please try out version 0.19.

§
Posted: 06-09-2024

I just installed an update and confirmed that you are my God.

§
Posted: 06-09-2024

Dear my God, I have one more question for you.
In this version, even if the link contains an image, it will be treated as invisible, right?
I'm asking because sometimes Tweets are shared as links without any image attachments.

CroAuthor
§
Posted: 06-09-2024

If links produce 'media' objects in the tweet, then it wont get filtered, otherwise it will. If you find more tweets that you think are not getting filtered properly, post them here.

§
Posted: 06-09-2024

To give you an idea, here's an example
https://x.com/19950918hch/status/1831658491674755179
The tweet in question has only text in the body, and an image generated by the attached link.
But, my God, your script is treating this as a tweet without an image.

CroAuthor
§
Posted: 06-09-2024

I found the object that creates URL pics. Please try version 0.20.

§
Posted: 06-09-2024

Thank you so much.
If you don't mind, may I ask you an additional question?
What should I do to make sure that the card created by the link is invisible if a specific phrase is included?
I've been thinking about it for a long time, but it hasn't been resolved, I need your valuable advice.

CroAuthor
§
Posted: 06-09-2024
Edited: 06-09-2024

If I understand correctly, I think it would look like this, in my code:

    let ignore_text = (obj, text_list) => !find_objects_at_keys(obj, ['full_text']).some(e => text_list.some(t => e.includes(t)));
    let has_media = (obj) => obj.entryId.includes("cursor-")
        || (
            any_key_in_obj(obj, ['media', 'card'])
            && ignore_text(obj, ["MY TEXT", "some other text", "abcd 1234"])
        );
§
Posted: 07-09-2024
Edited: 07-09-2024

I was returning from an international business trip and it took a long time to verify.
As you said, I applied the code and specified the text, but the link with that text is still showing up.
https://x.com/yeonnu__/status/1832350271806013543
Here's the code, including the text I added

let ignore_text = (obj, text_list) => !find_objects_at_keys(obj, ['full_text']).some(e => text_list.some(t => e.includes(t)));
let has_media = (obj) => obj.entryId.includes("cursor-")
|| (
any_key_in_obj(obj, ['media', 'card'])
&& ignore_text(obj, ['SpinSpin'])
);

What did I do wrong? Please let me know!

CroAuthor
§
Posted: 07-09-2024

Okay, I see that your target is the URL. Here is some new code:

    let ignore_text_at_keys = (obj, keys, text_list) => !find_objects_at_keys(obj, keys).some(e => text_list.some(t => e.includes(t)));
    let has_media = (obj) => obj.entryId.includes('cursor-')
        || (
            any_key_in_obj(obj, ['media', 'card'])
            && ignore_text_at_keys(obj, ['expanded_url'], ['spinspin.net'])
        );
§
Posted: 08-09-2024

Thank you for your continued interest. Dear God.
I didn't realize you had replied and tried to solve the problem myself.
I'm a layman who knows nothing about programming, and I'm ignorant of common courtesy among programmers.
It's not that I distrust you, or that I'm impatient to wait.
It's just that my personality is such that I like to try and test things myself.
I hope you don't mind.
Here's the code I came up with through trial and error.

let has_SpinSpin_in_preview = (obj) => {
return !(JSON.stringify(obj).includes('SpinSpin') || JSON.stringify(obj).includes('spinspin.net'));
};
let has_media = (obj) => {
return obj.entryId.includes('cursor-') || (any_key_in_obj(obj, ['media', 'card']) && has_SpinSpin_in_preview(obj));
};

I haven't tested it extensively, so I can't say for sure, but it seems to work fine.
Is there something I'm doing wrong?
Is there something that doesn't suit your development style?
I'd appreciate it if you could let me know.

CroAuthor
§
Posted: 08-09-2024

If that works for you, then please feel free to use it. The only issue is that it might be a bit slower because it's having to convert the tweet object back into a string multiple times.

§
Posted: 08-09-2024

I can't have it all, I guess.
I've been pestering you for days, and I appreciate your kind response.

Post reply

Sign in to post a reply.