-
Notifications
You must be signed in to change notification settings - Fork 667
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
Signup function gets interrupted by Instagram #1999
Comments
Now I got this error :
|
Try The code your friend is using appears to be mostly correct, but there are a few areas where issues might arise, particularly regarding the signup process with Instagram’s API. Here are some suggestions to troubleshoot and potentially resolve the error:
If the signup method doesn’t handle password encryption internally, ensure that it’s encrypted using the password_encrypt method from the Client class before passing it to the signup method. encrypted_password = client.password_encrypt(password)
client.set_user_agent("Instagram 123.0.0.20.114 Android (28/9; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)")
Suggested Changes to the Code: import hashlib client = Client() Optional: Set User-Agent if not handled by Clientclient.set_user_agent("Instagram 123.0.0.20.114 Android (28/9; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)") Set proxy if necessaryclient.set_proxy('socks5://...') Generate and set device_idclient.device_id = "android-%s" % hashlib.sha256(str(time.time()).encode()).hexdigest()[:16] email = 'example@gmail.com' Encrypt the password if requiredencrypted_password = client.password_encrypt(password) try: If Problems Persist: If the error continues even after these changes, it might be worth debugging further by inspecting the exact request and response being sent to Instagram’s API, potentially using a tool like Fiddler or Wireshark to capture the traffic and see what might be causing the 400 Bad Request error. |
Suggested Changes to the Code: import hashlib client = Client() Optional: Set User-Agent if not handled by Clientclient.set_user_agent("Instagram 123.0.0.20.114 Android (28/9; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)") Set proxy if necessaryclient.set_proxy('socks5://...') Generate and set device_idclient.device_id = "android-%s" % hashlib.sha256(str(time.time()).encode()).hexdigest()[:16] email = 'example@gmail.com' Encrypt the password if requiredencrypted_password = client.password_encrypt(password) try: |
But just know not detection is very good The issue where the account is immediately banned upon creation, resulting in the 1. Proxy Quality and IP Reputation
2. Human-like Behavior
3. Account Warm-up
4. Device and User-Agent Configuration
5. Session Management
6. Email and Phone Number Validation
7. Consider API Changes or Blockages
8. Advanced Techniques
Example Modifications:Here’s how you might modify the code to improve its chances of success: def signup(self, email, password, email_password, username, display_name, phone_number, proxy):
self.email = email
self.email_password = email_password
self.number = phone_number
self.reset_client() # Reset the Client object before each login attempt
proxy_str = f"http://{proxy['username']}:{proxy['password']}@{proxy['ip']}:{proxy['port']}"
logging.info(f"Setting proxy: {proxy_str} for {username}")
self.cl.set_proxy(proxy_str)
self.cl.set_settings({})
device_settings = self.generate_device_settings_signup()
logging.info(f"generated device settings : {device_settings}")
user_agent = self.generate_user_agent_signup(device_settings)
logging.info(f"generated user agent {user_agent}")
# Generate consistent device ID
device_id = self.generate_device_id_signup(device_settings)
logging.info(f"generated device ID : {device_id}")
# Generate phone ID
phone_id = self.generate_phone_id_signup(device_settings)
logging.info(f"generated phone ID : {phone_id}")
# Set device settings, including the device ID
device_settings['device_id'] = device_id
self.cl.device_id = device_id
self.cl.phone_id = phone_id
self.cl.set_device(device_settings)
self.cl.set_user_agent(user_agent)
# Introduce random delay to simulate human behavior
time.sleep(random.uniform(5, 15))
try:
user = self.cl.signup(
username, password, email, phone_number, display_name,
year=random.randint(1970, 2004),
month=random.randint(1, 12),
day=random.randint(1, 28)
)
logging.info("Account created, initiating warm-up activities...")
# Perform warm-up activities to reduce chances of ban
self.cl.account_set_private(False) # Set the account to public
time.sleep(random.uniform(5, 15))
self.cl.account_set_biography("New to Instagram, exploring the platform!")
time.sleep(random.uniform(5, 15))
self.cl.account_change_picture("path_to_profile_picture.jpg")
time.sleep(random.uniform(5, 15))
# Optional: Interact with the platform to warm up the account
self.cl.media_like('some_media_id')
except Exception as e:
logging.error(f"Error creating account: {e}")
return None
return user Conclusion:By incorporating more randomness, engaging in warm-up activities, and ensuring realistic settings and behaviors, you can improve the chances of successfully creating an Instagram account without it being immediately banned. However, Instagram’s anti-bot measures are very sophisticated, so there's no guarantee, especially if many accounts are being created programmatically. |
Lastly update ur def to be more real something like: Here’s a working version of the functions with added realism and variability: import hashlib
import random
import uuid
class InstagramSignupHelper:
def generate_user_agent_signup(self, device_settings):
locales = ["en_US", "en_GB", "en_CA", "es_ES", "fr_FR"] # Various locales
locale = random.choice(locales)
# Add a random build number or incremental version to the Android release
build_number = f"{random.randint(100000, 999999)}"
user_agent_template = (
"Instagram {app_version} Android ({android_version}/{android_release}.{build_number}; "
"{dpi}; {resolution}; {manufacturer}; {model}; {device}; {cpu}; {locale}; {version_code})"
)
user_agent = user_agent_template.format(
build_number=build_number,
locale=locale,
**device_settings
)
return user_agent
def generate_device_settings_signup(self):
android_versions = [
(26, "8.0.0"), (27, "8.1.0"), (28, "9.0.1"), (29, "10.0.1"), (30, "11.0.3"), (31, "12.1.2")
]
devices = [
("OnePlus", "OnePlus", "6T Dev", "devitron", "1080x2280", "420dpi"),
("Samsung", "Samsung", "Galaxy S10", "beyond1", "1440x3040", "550dpi"),
("Google", "Google", "Pixel 4", "flame", "1080x2280", "443dpi"),
("Xiaomi", "Xiaomi", "Mi 9", "cepheus", "1080x2340", "403dpi"),
("Huawei", "Huawei", "P30 Pro", "vogue", "1080x2340", "398dpi"),
# Add more devices with varied screen resolutions and DPIs
]
cpu_types = ["qcom", "exynos", "kirin", "mtk"] # Including Mediatek (mtk)
android_version, android_release = random.choice(android_versions)
manufacturer, brand, model, device, resolution, dpi = random.choice(devices)
cpu = random.choice(cpu_types)
app_version = "269.0.0.18.75"
version_code = "314665256"
device_settings = {
"app_version": app_version,
"android_version": android_version,
"android_release": android_release,
"dpi": dpi,
"resolution": resolution,
"manufacturer": manufacturer,
"device": device,
"model": model,
"cpu": cpu,
"version_code": version_code
}
return device_settings
def generate_device_id_signup(self, device_settings):
device_info = (
f"{device_settings['manufacturer']}_{device_settings['model']}_"
f"{device_settings['device']}_{device_settings['android_version']}_"
f"{device_settings['android_release']}_{random.randint(1000, 9999)}"
)
hash_object = hashlib.md5(device_info.encode())
return f"android-{hash_object.hexdigest()[:16]}"
def generate_phone_id_signup(self, device_settings):
device_info = (
f"{device_settings['manufacturer']}_{device_settings['model']}_"
f"{device_settings['device']}_{device_settings['android_version']}_"
f"{device_settings['android_release']}_{random.randint(1000, 9999)}"
)
hash_object = hashlib.sha256(device_info.encode())
return str(uuid.UUID(hash_object.hexdigest()[:32]))
# Example usage
helper = InstagramSignupHelper()
# Generate realistic device settings
device_settings = helper.generate_device_settings_signup()
print("Device Settings:", device_settings)
# Generate user agent based on device settings
user_agent = helper.generate_user_agent_signup(device_settings)
print("User Agent:", user_agent)
# Generate device ID
device_id = helper.generate_device_id_signup(device_settings)
print("Device ID:", device_id)
# Generate phone ID
phone_id = helper.generate_phone_id_signup(device_settings)
print("Phone ID:", phone_id) Explanation:
This setup should create more varied and realistic device and user agent configurations, which could help in reducing the chances of being detected as automated when interacting with Instagram's API. |
Still getting the same issue after all these recommendations (I've already used an LLM to suggest such improvements). |
Use my outlook email creator. That might be the issue. |
How are you defining email? Curious. |
Add me as a friend on Discord! Invite expires in 1 week: https://discord.gg/hPTX2k7r |
@sujay1599 using MailTM : https://github.com/rpwnage/MailTMClient/tree/main |
Can you provide me with a link please ? |
Outlook-Email-Creator/SOURCE - microsoft-account-creator-main at main · sujay1599/Outlook-Email-Creatorgit.luolix.topSent from my iPhoneOn Aug 10, 2024, at 3:31 PM, Yassine Ait Jeddi ***@***.***> wrote:
Use my outlook email creator.
That might be the issue.
Can you provide me with a link please ?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I tried signup using a gmail email as well. I got the same issue. |
Hi Community. I was able to use the signup method to create new account using the following code :
The code is able to do the first steps :
But unfortunayly, it doesn't succeed to finishing the account creation as it returns an Instagram User for the username, which means that the account was banned once it was created duo to terms violation :
I'm using strong ISP proxies from Rayobyte provider. The generation of device settings and user agent is required here to be used in the account forever after the creation. Here are the functions responsible for generating these settings :
I hope there is a solution to fix this. Thank you in advance.
The text was updated successfully, but these errors were encountered: