TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Simple script to cripple personalized targeting from Facebook

205 点作者 GeoHubToday11 个月前

27 条评论

bqmjjx0kac11 个月前
This got a little stuck on a few of the `.click()` calls for me. Here&#x27;s my version:<p><pre><code> const wait = () =&gt; new Promise(resolve =&gt; setTimeout(resolve, 1000)); const getElementsByAriaLabel = (label) =&gt; document.querySelectorAll(`[aria-label=&quot;${label}&quot;]`); const getElementsByRoleAndWidth = (role, width) =&gt; Array.from(document.querySelectorAll(`[role=&quot;${role}&quot;]`)).filter(el =&gt; el.clientWidth === width); const getElementsByText = (text) =&gt; Array.from(document.querySelectorAll(&#x27;*&#x27;)).filter(el =&gt; Array.from(el.childNodes).some(node =&gt; node.nodeType === Node.TEXT_NODE &amp;&amp; node.textContent.includes(text)) ); async function clickAndWait(elem) { if (!elem) return; elem.click(); await wait(); } await clickAndWait(getElementsByText(&quot;See more&quot;)[0]); const ads = getElementsByRoleAndWidth(&#x27;listitem&#x27;, 508); for (const ad of ads) { console.log(ad.childNodes[0].textContent) await clickAndWait(ad.childNodes[0]); await clickAndWait(getElementsByText(&#x27;They uploaded or used a list to reach you.&#x27;)[0]); const dont_allow_btns = getElementsByText(&#x27;Don\&#x27;t allow&#x27;); for (const btn of dont_allow_btns) { btn.click(); } await wait(); await clickAndWait(getElementsByAriaLabel(&#x27;Back&#x27;)[2]); await clickAndWait(getElementsByAriaLabel(&#x27;Back&#x27;)[2]); }</code></pre>
评论 #40763131 未加载
评论 #40763012 未加载
评论 #40763036 未加载
junto11 个月前
Cool script.<p>My hack is to live in a country where the local language is not my own, and not the one I have set in my Facebook settings.<p>As a result, Facebook rarely has advertisements that can target me, because my language has been filtered out by the advertisers.<p>When one does appear, it’s nearly always in the local language, so I’m kind of deaf to it and I’m not going to actively respond to anyway.<p>Luckily they haven’t figured that out yet, even though I’ve been an Facebook user for many years.
评论 #40762599 未加载
评论 #40763550 未加载
评论 #40765520 未加载
tgsovlerkhgsel11 个月前
Much more entertaining: Get the list of advertisers. Find the ones who aren&#x27;t allowed to share your data with Facebook, e.g. due to lack of consent or because they&#x27;re bound by professional secrecy (e.g. banks or health related things). Report to your local DPA.
评论 #40763790 未加载
评论 #40763599 未加载
评论 #40763616 未加载
Terr_11 个月前
Reminds me of a court case [0] proactively challenging Facebook, due to a time the company gave someone a lifetime ban [1] for making this kind of consumer-tool.<p>[0] <a href="https:&#x2F;&#x2F;www.theregister.com&#x2F;2024&#x2F;05&#x2F;02&#x2F;meta_facebook_tool&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.theregister.com&#x2F;2024&#x2F;05&#x2F;02&#x2F;meta_facebook_tool&#x2F;</a><p>[1] <a href="https:&#x2F;&#x2F;slate.com&#x2F;technology&#x2F;2021&#x2F;10&#x2F;facebook-unfollow-everything-cease-desist.html" rel="nofollow">https:&#x2F;&#x2F;slate.com&#x2F;technology&#x2F;2021&#x2F;10&#x2F;facebook-unfollow-every...</a>
评论 #40762675 未加载
EvgeniyZh11 个月前
Reminder to use AdNauseum [1] that will not only hide the ads but also click it, messing with targeting and spending advertisers&#x27; money at the same time.<p>[1] <a href="https:&#x2F;&#x2F;adnauseam.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;adnauseam.io&#x2F;</a>
mgraczyk11 个月前
What is the motivation to prefer untargeted ads over targeted ones?
评论 #40763520 未加载
评论 #40763719 未加载
评论 #40763214 未加载
评论 #40763221 未加载
评论 #40763351 未加载
评论 #40789291 未加载
josephcsible11 个月前
I&#x27;m worried that if you use this, Facebook will permaban you for something like &quot;using modified or unauthorized clients to interact with Facebook services&quot;.
评论 #40763845 未加载
SSLy11 个月前
Intresting, for me the link 404&#x27;s<p><pre><code> This page isn&#x27;t available The link may be broken or the Page may have been removed. Check to see if the link that you&#x27;re trying to open is correct. Go to Accounts Centre </code></pre> also<p><pre><code> Uncaught SyntaxError: await is only valid in async functions, async generators and modules</code></pre>
评论 #40763115 未加载
评论 #40763228 未加载
Terr_11 个月前
Separately, Firefox has a feature to isolate Facebook activity from other things you do on the web.
评论 #40763059 未加载
stevage11 个月前
Weirdly, as much as I hate internet ads in general, I actually find the FB ones better. I&#x27;ve even bought some stuff from a few and been happy.
评论 #40763850 未加载
atleta11 个月前
For me the correct URL seems to be: <a href="https:&#x2F;&#x2F;www.facebook.com&#x2F;adpreferences&#x2F;ad_settings&#x2F;?section=audience_based_advertising&amp;entry_product=accounts_center" rel="nofollow">https:&#x2F;&#x2F;www.facebook.com&#x2F;adpreferences&#x2F;ad_settings&#x2F;?section=...</a> instead of what you have in the gist. (But the script errs on the awaits.)
评论 #40763670 未加载
评论 #40763222 未加载
29athrowaway11 个月前
I heard that sites like Facebook run A&#x2F;B tests all the time, and the version you get served at a given time may not be the same others see. I also suppose the version you see may be slightly different on different territories somehow.<p>Also, these scripts break often as they depend on observable behaviors that are not contracts. It&#x27;s Hyrum&#x27;s law again.
rkagerer11 个月前
Does this just impact ads shown on the site, or does it also cut down on data collection and targeting that occurs when you browse to third party sites who happen to include javascript from Facebook?<p>How&#x27;s this technique compare to just staying logged out of Facebook? Or using it solely in a sandboxed browsing environment?
评论 #40762671 未加载
throwaway_575311 个月前
What&#x27;s the legality of a script like this? Could this be construed as a violation of the CFAA if you were a motivated&#x2F;evil enough lawyer?<p>I recall some surprising legal outcomes in recent years, for example jail for posting fake Yelp reviews. Anyone know of any case law for this sort of scripting?
评论 #40763646 未加载
technion11 个月前
The part I&#x27;m finding most interesting is that I clicked this link and have never heard of pretty much any of the targeted advertisers listed there.
GeoHubToday11 个月前
OP here, I&#x27;ve updated the script for a bit more robust support when dealing with slow&#x2F;delayed endpoint calls! Thanks for the feedback, HN!
seadan8311 个月前
Awesome script! I&#x27;m watching it run now :)<p>Question, could someone explain the exact impact this would have for Facebook &amp; a person&#x27;s experience with ads?<p>I kinda have a few guesses, but am curious if anyone can weigh in with more info, how this is crippling and overall what the effect should be. Thanks!
评论 #40763504 未加载
unstatusthequo11 个月前
What browser is this intended for? The below error comes up on Brave on MacOS. Both most up to date version.<p>VM172:14 Uncaught TypeError: Cannot read properties of undefined (reading &#x27;click&#x27;) at &lt;anonymous&gt;:14:71 (anonymous) @ VM172:14
评论 #40762683 未加载
评论 #40763226 未加载
rayeng11 个月前
<a href="https:&#x2F;&#x2F;www.facebook.com&#x2F;profile.php?id=61560741635214" rel="nofollow">https:&#x2F;&#x2F;www.facebook.com&#x2F;profile.php?id=61560741635214</a>
jeremiemyhren11 个月前
I get this on Safari on macOS: SyntaxError: Unexpected identifier &#x27;wait&#x27;<p>and this on Chrome on macOS: TypeError: Cannot read properties of undefined (reading &#x27;click&#x27;) at &lt;anonymous&gt;:14:71
评论 #40763219 未加载
bequanna11 个月前
This doesn&#x27;t appear to recognize any existing &#x27;Don&#x27;t allow&#x27; selections and fails when you&#x27;ve already disallowed some advertisers.
smashah11 个月前
Godspeed good sir. When those shitheads from PerkinsCoie send you a legal threat make sure to share and shame them for it.
exabrial11 个月前
Unbelievable and incredible who hard Facebook makes this to do by hand. Completely unethical
smusamashah11 个月前
What are the actual steps using the UI if one chooses to do it manually?
评论 #40763173 未加载
ThinkBeat11 个月前
and he is banned from Facebook.<p>(for some that is a relief for others it is serious)
exabrial11 个月前
Anyone have something like this for Google?
JojoFatsani11 个月前
Thank you OP, you&#x27;re a mensch.