I’m writing a bot. I just created a Backrooms community (!backrooms@lemmy.world) and I want a bot to post links (as the user @backroomsbot@lemmy.world) to Backrooms-related content from the Backrooms wikis on a regular basis. (My current thought is daily, but I could be persuaded otherwise.) I might also add other features in the future like checking Kane Pixels’ YouTube channel and automatically posting links to his new videos, but that’s probably a later (if ever) kind of feature. I don’t have any specific plans to add any kind of automod or mod tools capabilities at this point. (In fact, I don’t have plans to make the bot account a mod in the community.) But I guess there might be a future when that happens.
I’ve read the Bot Usage and Guidelines section of the TOS and I’ve read this thread. It’s all straightforward and I’m following all the rules and guidelines. My plan is not to put it on a cron for a while. I’ll just run it manually every day for a while (until it proves itself) so that I can inspect what it does and if it misbehaves (not that I expect it to, but out of an abundance of caution) fix issues quickly to not impact users on Lemmy. I have also tested it on a locally-running Lemmy instance to ferret out any bugs or bad behaviors. It doesn’t accept any commands from other users (well, except command-line arguments from me when I run it on my computer from a Bash prompt, but it doesn’t take any actions in response to being @'d or DMed or anything). It DMs my user account when it encounters an error. I’ve been a professional software engineer for decades, so I like to think I know a little bit about what I’m doing. (Not that that means I’m incapable of producing bugs, but yeah.) And I cannot express in strong enough terms how cold and dead I will be in the ground before I put even a single solitary god-damned line of GenAI-generated code in any coding project I write. This is not some vibe-coded monstrosity. I wrought every single line using my brain, Go documentation, and Vim as God intended.
Oh, and I’ll publish my bot’s code on Codeberg or something under AGPL one of these days once it has demonstrated real-world success at doing what it does for a while.
All that to justify my use of “friendly” in the title of this post. Heh.
Anyway! To my question. My bot is being blocked by Cloudflare’s CAPTCHA verification. You know, the thing specifically intended to repel bot traffic. Bots do seem to be explicitly allowed by .world’s rules, so long as they follow all the rules. And I’ve definitely seen other bot accounts successfully posting. So my guess is that there’s some good way to get my bot posting properly without being intercepted by Cloudflare. All that said, my searching hasn’t revealed anything specific about how exactly that could be made to work. I’m hoping someone here can give me a lead or two, or just tell me why I’m wrong-headed about some basic assumption I’m making.
Thanks in advance!
MrKaplan@lemmy.world 1 day ago
Hello,
use the official Lemmy API for automated interactions, don’t use headless browsers or pretend to be a browser.
TootSweet@lemmy.world 1 day ago
I’m not using any headless browser or anything. I’m using Go’s “net/http” package from the standard library which just… makes HTTP requests. I’m making requests to endpoints like
https://lemmy.world/api/v3/user/loginandhttps://lemmy.world/api/v3/post. The basic process is that every time it runs, it:The user agent it uses is
Go-http-client/1.1if that helps any.MrKaplan@lemmy.world 1 day ago
Then I don’t know where you’re seeing Cloudflare CAPTCHAs. There shouldn’t be any on any of the API paths.
I’ve checked both URLs you mentioned above and only saw a Python user agent getting blocked with a browser integrity check on one of them in our CF logs. I’ve now added a dedicated rule to skip browser integrity checks on all API paths.