-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Troubleshooting Automated DMs with Python’s Twikit Package – Avoiding the “Looks Automated” Error (Code 226) #247
Comments
Hello, do you use proxies? If so, what type of proxies do you use (datacenter, residential etc)? |
@desktop69
|
Hi! Yes, I'm currently working on the proxy setup. I did some research and even spoke with support at Oxylabs, where they recommended regional proxies. However, they're quite expensive—about $100 per month for 8GB of data, which is a bit much for me. I also got advice online to consider using a torrent-based proxy, but I haven’t figured out how to find or integrate this kind of proxy with Twikit yet. If you have any insights on that, I’d really appreciate it. Thanks! |
For this type of issue, the Twikit package author is still working on a solution. In the meantime, I found a workaround by bypassing the login feature using a Chrome extension called Cookies Editor. Just log in to your account on the web, then copy and paste the relevant values into an existing cookies file from Twikit. You’ll only need those specific values for it to work. |
@desktop69; I am trying to figure out what triggers the I noticed some static residential proxies don't trigger this error. They might be flagging IPs based on the previous activity. Just my thought, not 100% sure. And not a solution but when you retry the failed action multiple times with 2-5 second intervals, it might be succeed. |
Hey there, it's great to connect with someone who's been using Twitter automation for three years! I've just started getting into it over the past month. Would you mind sharing any insights on using proxies and what sources you’re using? I'm really struggling to figure it out. |
Hey bro, did you happen to find the problem yet? |
@desktop69; I am using static residential proxies from Webshare. I wanted to reply after a few days of testing. So I figured out the problem isn't about the proxy, now I'm 90% sure it's about the @DanteKallen Unfortunately. |
From https://abs.twimg.com/responsive-web/client-web/main.bfe3e92a.js. Maybe you can continue from there. I also inspected the header parameters used by the Twikit package and noticed that this variable is indeed missing. This could be a key factor in the issue. It's frustrating, right? Automating Twitter used to be so much more straightforward pre-Elon! 😅 Anyway, thanks again for testing and sharing your findings—it’s definitely helpful as we try to untangle this! 🚀 |
Apparently, twikit already includes this header in the request |
Hello everyone! 👋
I’m currently working on a Twitter bot using Python and the Twikit package. The goal is to target specific users and send them a direct message (DM) only if there’s no prior DM history with them.
Here’s the core problem: occasionally, I get the following error when trying to send DMs:
Error sending DM to <User id="01010101">: status: 403, message: "{"errors":[{"code":226,"message":"This request looks like it might be automated. To protect our users from spam and other malicious activity, we can't complete this action right now. Please try again later."}]}"
I’ve tried adding various delays and even appended random characters to the end of each message to make it look more “human.” However, the error still occurs frequently enough to interrupt the bot’s workflow.
Code Context
Below is the main code segment of my bot (simplified for readability)
`import asyncio
import random
import string
async def main():
# Code to initialize and authenticate client
messages_sent = 0
`
Strategies I’ve Tried So Far
Random Delays: Adding randomized delays between different stages of the DM workflow, as well as a longer delay after every 12 messages to avoid rate-limiting issues.
Message Randomization: Adding a random character (both uppercase and lowercase) at the end of each message to make it look less predictable.
The Persistent Issue:
Despite these efforts, I still receive a 403 error with Code 226, suggesting that Twitter’s anti-spam mechanism detects these requests as automated.
Questions for the Community
Any help or insight would be much appreciated. Thanks in advance for reading, and I’m looking forward to hearing your suggestions!
The text was updated successfully, but these errors were encountered: