A powershell script to easily find "hidden" spam links

I recently got fed up with seeing posts that look like spam, either because they don’t make sense or appear to be copy-pasted from an LLM. While they don’t initially contain any obvious spam links, those links often turn up in sneaky places, like embedded in commas or periods.

To help identify these more easily, I created a PowerShell script that checks a Discourse topic (provided as a parameter) and prints all posts containing external links. Of course, just having an external link doesn’t mean a post is spam, but having a quick list of all external links in a topic makes spotting suspicious posts much easier.

It’s very simple to use from the command line, just pass the topic URL as a parameter. For example:
.\Check-Discourse-Topic-Links.ps1 https://discussions.unity.com/t/is-it-a-good-idea-to-put-my-game-on-itch-io-first/1657629

This will output only the external links, along with the post number and author, like so:

External link found in post number: 1 by SpideyByte
http://itch.io

External link found in post number: 4 by meredoth
https://howtomarketagame.com/2025/05/22/more-games-that-made-the-itch-io-to-steam-transition/

External link found in post number: 4 by meredoth
https://howtomarketagame.com/2025/05/12/benchmark-itch-io-traffic/

External link found in post number: 4 by meredoth
http://itch.io

External link found in post number: 7 by SpideyByte
http://itch.io

The -verbose parameter works as expected and provides additional information about the results.

Here’s the gist for anyone who might find it useful:
https://gist.github.com/meredoth/a95398fdd5561d151bd5fd84d6ea2740

1 Like

If possible you should also log the hyperlink text in a third line so it would make spam immediately obvious:

External link found in post number: 4 by meredoth
https://howtomarketaspam.com/2025/05/22/more-spam-that-spam-the-spam-io-to-spam-transition/
,

Where the , would be the link text.

PS: Can I get a Mac version? :grin:

2 Likes

Done. Now the results display the link text too:

External link found in post number: 1 by SpideyByte
http://itch.io
Link Text: itch.io

External link found in post number: 4 by meredoth
https://howtomarketagame.com/2025/05/22/more-games-that-made-the-itch-io-to-steam-transition/
Link Text: https://howtomarketagame.com/2025/05/22/more-games-that-made-the-itch-io-to-steam-transition/

External link found in post number: 4 by meredoth
https://howtomarketagame.com/2025/05/12/benchmark-itch-io-traffic/
Link Text: https://howtomarketagame.com/2025/05/12/benchmark-itch-io-traffic/

External link found in post number: 4 by meredoth
http://itch.io
Link Text: itch.io

External link found in post number: 7 by SpideyByte
http://itch.io
Link Text: itch.io

EDIT: PowerShell 7.x is built on .NET Core, which is cross-platform, unlike version 5.1, which is built on the .NET Framework. I don’t have a Mac, but I believe you can install PowerShell 7.x on it.

EDIT2: For those who prefer C#, I’ve added the equivalent C# script to the gist above.

2 Likes