Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide "suggested for you" posts and "you may like" cards #195

Open
test2a opened this issue Oct 26, 2023 · 9 comments
Open

Hide "suggested for you" posts and "you may like" cards #195

test2a opened this issue Oct 26, 2023 · 9 comments

Comments

@test2a
Copy link

test2a commented Oct 26, 2023

  1. Suggested for you content. Would it be possible to hide these simply by checking if suggested for you keyword exists for a post ?

  2. People you may know or groups you may know. Can these cards be detected and hidden ?

@diesel701
Copy link

I think it can be easily implemented. Nice suggestions.

@shamirahim111
Copy link

@diesel701

! Suggested for you
www.facebook.com##:is([aria-posinset],[aria-describedby]:not([aria-posinset])) div:not(:only-child)>div:only-child>div:only-child>div:first-child[class=""]>div:not([data-0]):has-text(/^Suggested/):upward([aria-posinset],[aria-describedby]:not([aria-posinset]))
! Unlabelled Suggested posts (with a Follow button)
www.facebook.com##:is([aria-posinset],[aria-describedby]:not([aria-posinset])) :is(h3,h4) [role=button]:has-text(Follow):upward([aria-posinset],[aria-describedby]:not([aria-posinset]))
! Use only if you actually have these: Suggested posts with the label next to the post date
www.facebook.com##:is([aria-posinset],[aria-describedby]:not([aria-posinset])):has-text(Suggested for you)
! People You May Know
www.facebook.com##:is([aria-posinset],[aria-describedby]:not([aria-posinset])) [aria-label="See all"][href="/friends/"]:upward([aria-posinset],[aria-describedby]:not([aria-posinset]))
! Suggested groups
www.facebook.com##:is([aria-posinset],[aria-describedby]:not([aria-posinset])) [aria-label="See more groups"][href="/groups/discover/"]:upward([aria-posinset],[aria-describedby]:not([aria-posinset]))
! Reels and short videos
www.facebook.com##:is([aria-posinset],[aria-describedby]:not([aria-posinset])) [aria-label="See more"][href="/reel/?s=ifu_see_more"]:upward([aria-posinset],[aria-describedby]:not([aria-posinset]))
! Suggested pages
www.facebook.com##:is([aria-posinset],[aria-describedby]:not([aria-posinset])) [aria-label="Suggested pages"]:upward([aria-posinset],[aria-describedby]:not([aria-posinset]))

---Mobile---
! Suggested for you (mobile)
m.facebook.com##[data-mcomponent="MScreen"]>div[class="m"]>div:has-text(Suggested for you)

these are working on ublock origin for me on desktop so maybe they can be adjusted for slimsocial?

@diesel701
Copy link

@shamirahim111
I tried the last one for mobile with Firefox on Android but I got a glitchy behaviour of the scroll.
Probably I will keep using SlimSocial with the "suggested" pages.

@adsarwal
Copy link

This would be a fantastic enhancement for a fantastic app.

@rignaneseleo
Copy link
Owner

Facebook changed its code so I can't intercept the ads anymore.

Let's see if we get help from this other dev: zbluebugz/facebook-clean-my-feeds#66

@zbluebugz
Copy link

Here's a snippet for hiding Sponsored posts on m.facebook.com:

function hideSponsoredPosts() {
  // -- dictionary of words to detect - must be in regex format.
  const DICTIONARY = new RegExp('Sponsored|Patrocinado|Gesponsert'.toLowerCase());

  // -- get collection of posts:
  posts = document.querySelectorAll('div[data-type="vscroller"] > div[data-mcomponent="MContainer"][data-tracking-duration-id]:not([hsp])');
  // -- scan each post for "Sponsored"
  posts.forEach( (post) => {
    // -- get the <element> that has the post's date/time/<certain phrases>
    const headerMeta = post.querySelector(':scope > div > div > div:nth-of-type(2) > div:last-of-type > div > span:first-of-type');
    if (headerMeta !== null) {
      // -- a typical post
      if (DICTIONARY.test(headerMeta.innerText.toLowerCase())) {
        // -- found a Sponsored post, hide it (do not remove - fb hates that!)
        post.setAttribute('data-actual-height', '0');
        post.style.height = '0';
        post.setAttribute('hsp', 'Sponsored');
      }
    }
  })
}

@rignaneseleo
Copy link
Owner

Thanks for sharing but unforutunatly this doesn't seem to work on touch.facebook.com :(

@zbluebugz
Copy link

Is it possible to get a Windows10 browser to visit touch.facebook.com without being redirected to www.facebook.com?

@rignaneseleo
Copy link
Owner

Is it possible to get a Windows10 browser to visit touch.facebook.com without being redirected to www.facebook.com?

I guess you need to change the User Agent to a mobile one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants