iorate / ublacklist

Blocks specific sites from appearing in Google search results
https://iorate.github.io/ublacklist/
MIT License
5.72k stars 300 forks source link

Not working at all on Startpage. #443

Closed linlinxza closed 6 months ago

linlinxza commented 7 months ago

Expected Behavior

Filtering should work on startpage.

Actual Behavior

Not filtering at all.

Steps to Reproduce the Problem

1.Install addon

  1. Add an expression like *://*.reddit.com/*
  2. Enable for startpage.com
  3. Activate 5.Search for reddit

Specifications

It might be worth also checking the mobile version of startpage.

linlinxza commented 7 months ago

So, when's a new update going to be pushed for this? Because I really want to see all this junk disappear from my search results:

*://*.reddit.com/*
*://*.fb.com/*
*://*.redditinc.com/*
*://*.linkedin.com/*
*://*.threads.com/*
*://*.meta.com/*
*://*.messenger.com/*
*://*.metacareers.com/*
*://*.snapchat.com/*
*://*.apple.com/*
*://*.icloud.com/*
*://*.live.com/*
*://*.msn.com/*
*://*.microsoft.com/*
*://*.office.com/*
*://*.skype.com/*
*://*.bytedance.com/*
*://*.microsoft365.com/*
*://*.windows.com/*
*://*.hpconnected.com/*
*://*.hpsmart.com/*
*://*.samsung.com/*
*://*.canon.com/*
*://*.play.google.com/*
*://*.myspace.com/*
*://*.adobe.com/*
*://*.photoshopessentials.com/*
*://*.photoshop.com/*
*://*.bing.com/*
*://*.bingplaces.com/*
*://*.xbox.com/*
*://*.adobepress.com/*
*://*.amazon.com/*
*://*.primevideo.com/*
*://*.deviantart.com/*
*://*.deviantartsupport.com/*
*://*.deviantartsell.com/*
*://*.pinterest.com/*
*://*.tumblr.com/*
*://*.quora.com/*
*://*.visualstudio.com/*
*://*.sharepoint.com/*
*://*.facebook.com/*
*://*.twitter.com/*
*://*.instagram.com/*
*://*.tiktok.com/*
*://www.redditstatus.com/*
*://www.redditforbusiness.com/*
*://support.reddithelp.com/*
*://www.whatsapp.com/*
*://*.x.com/*
*://business.tiktokshop.com/*
*://www.onenote.com/*
*://sway.cloud.microsoft/*
*://*.amazon.ca/*
*://*.yahoo.com/*
*://www.yahooinc.com/*
*://discord.com/*
*://discordapp.com/*
misumisumi commented 7 months ago

I am also facing this issue and after trying to debug it I found that the class name of startpage has most likely changed. Specifically w-gl__result no longer exists and .result exists under .w-gl. I tried adding the following config to my entryHandler but it didn't work:

          {
            target: '.result',
            url: '.result-title',
            title: 'h2',
            actionTarget: 'a[role="link"]',
            actionStyle: {
              display: 'block',
              marginTop: '4px',
            },
          },

What's strange is that the class name set with the result class displayed in Element is different from the corresponding class name set in Sources. This is not seen in duckduckgo, which works properly.

linlinxza commented 7 months ago

What about just use .w-gl? Or, could link-text work?

When I see something like this while inspecting, <span class="link-text">https://www.reddit.com/</span>, I suspect that could be used to filter out URLs. No? So, should the target be link-text?

misumisumi commented 7 months ago

At least I don't think .w-gl can be used because it is a container for the entire search result. 2024-05-02_04-21

linlinxza commented 7 months ago

link-text?

stevehartwell commented 7 months ago

Thanks @misumisumi for the ideas for a solution. I've looked at it some more and am currently trying this:

    entryHandlers: [
      // Web
      {
        target: '.w-gl > .result',
        url: '.w-gl > .result .result-title',
        title: 'h2',
        actionTarget: '.w-gl > .result > .description',
        actionStyle: {
          display: 'block',
          marginTop: '4px',
        },
      },
      . . .
   ]

This seems to make filtering work (I'm not sure what actionTarget is used for). Please try this and let us know if it works for you.

However, there is still some more work to do. It seems that the headline uBlacklist has blocked 1 site and Show button are not appearing at the top of the Startpage search results.

I have tried updating the control handler target

    controlHandlers: [
      // Web
      {
        target: '.Layout #main',
        style: defaultControlStyle,
      },
      . . .
   ]

but so far this hasn't worked. I'm not sure what it's looking for.

I may keep trying, though hopefully this info so far might be enough to be helpful to @iorate 😀

misumisumi commented 7 months ago

However, there is still some more work to do.

One of the problems is no showing Block this site, but I think this is due to the html class being changed for some reason. For example in duckduck-go, elements and classes referenced from Element and content-script.js are the same. image image

But in startpage, elements and classes refferenced from element and content-script.js are not the same. I checked with all other extensions such as adblock disabled, so I think it's a problem on the startpage side. image image

Probably, the behavior is to search for the entry container with target, specify the element within it with actionTarget, and add a block button with span to the specified element.

iorate commented 6 months ago

@misumisumi @stevehartwell Thank you for your investigation. I'll fix this issue soon.

Since the current version of Startpage uses React, modifications by the content script are cleaned up by the hydration process. To avoid this, the content script should be run after the page is loaded:

https://github.com/iorate/ublacklist/blob/924de298eb24b4c1d5a741baa211c6675f926314/src/common/search-engines.ts#L527 This value should be "document_idle".

iorate commented 6 months ago

Probably, the behavior is to search for the entry container with target, specify the element within it with actionTarget, and add a block button with span to the specified element.

That's true.

github-actions[bot] commented 6 months ago

:tada: This issue has been resolved in version 8.6.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: