کد اول به زبان php
توجه این کد نیاز به چکش کاری دارد و همینطوری برای شما شاید قابل استفاده نباشد.
نکته: این کد توسط سایت chatGPT تولید شده
// Create a new user account.
$url = 'https://www.instagram.com/accounts/web_create_ajax/';
$data = array(
'email' => '',
'password' => $password,
'username' => $username,
'first_name' => '',
'opt_into_one_tap' => 'false',
);
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
// Parse the response.
$response = json_decode($result, true);
if ($response['account_created'] == true) {
// Account created successfully.
$csrf_token = $response['csrf_token'];
$user_id = $response['user_id'];
$session_id = $response['session_id'];
// Set the URL and headers for the request
$url = 'https://www.instagram.com/accounts/web_change_profile_picture/';
$headers = array(
'Content-Type: multipart/form-data',
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0',
'Cookie: sessionid=' . $session_id . '; csrftoken=' . $csrf_token
);
// Set the data for the request body
$image_url = 'https://100k-faces.glitch.me/random-image';
$image_data = file_get_contents($image_url);
$body = array(
'Content-Disposition: form-data; name="Content-Type"' => 'multipart/form-data',
'Content-Disposition: form-data; name="profile_pic"; filename="profile.jpg"' => $image_data,
'Content-Disposition: form-data; name="_csrftoken"' => $csrf_token,
'Content-Disposition: form-data; name="_uid"' => $user_id,
'Content-Disposition: form-data; name="_uuid"' => generateUUID()
);
// Set the options for the request
$options = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => $headers
);
// Execute the request
$ch = curl_init();
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
// Check for errors and close the request
if(curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
}
curl_close($ch);
// Print the result
echo $result;
}
// Set the other required form data
$post_data = array(
'email' => $email,
'username' => $username,
'password' => $password,
'first_name' => $first_name,
'phone_number' => $phone_number,
'opt_into_one_tap' => 'false',
'seamless_login_enabled' => '1',
'tos_version' => 'row',
'creation_surface' => 'registration',
'gdpr_s' => '[0,2,0,null]',
'extra_data' => '{}',
'biography' => $biography
);
// Add the other form data to the request body
foreach ($post_data as $key => $value) {
$body .= $boundary . "\r\n";
$body .= 'Content-Disposition: form-data; name="' . $key . '"' . "\r\n\r\n";
$body .= $value . "\r\n";
}
// Add the profile picture to the request body
$image_url = 'https://100k-faces.glitch.me/random-image';
$image_contents = file_get_contents($image_url);
$body .= $boundary . "\r\n";
$body .= 'Content-Disposition: form-data; name="profile_pic"; filename="profile_pic.jpg"' . "\r\n";
$body .= 'Content-Type: image/jpeg' . "\r\n\r\n";
$body .= $image_contents . "\r\n";
// Add the final boundary to the request body
$body .= $boundary . '--' . "\r\n";
// Set the headers for the request
$headers = [
'Content-Type: multipart/form-data; boundary=' . $boundary,
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0',
'Cookie: ' . $cookie
];
// Set the options for the request
$options = [
CURLOPT_URL => 'https://www.instagram.com/accounts/edit/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => $headers
];
// Execute the request
$ch = curl_init();
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
// Check for errors and close the request
if(curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
}
curl_close($ch);
// Print the result
echo $result;
کد دوم به زبان PHP با استفاده از کامپوزر و کتاب خانه های زیر
require_once('vendor/autoload.php');
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverBy;
use Facebook\WebDriver\WebDriverExpectedCondition;
use Facebook\WebDriver\WebDriverAction;
// Set path to the Chrome driver executable file.
// You can download it from here: https://sites.google.com/a/chromium.org/chromedriver/downloads
$driver_path = '/path/to/chromedriver';
// Start the Chrome browser.
$chrome_options = new \Facebook\WebDriver\Chrome\ChromeOptions();
$chrome_options->addArguments(array(
'--disable-extensions',
'--profile-directory=Default',
'--incognito',
'--disable-plugins-discovery',
'--start-maximized'
));
$driver = RemoteWebDriver::create($driver_path, $chrome_options);
// Go to the Instagram signup page.
$driver->get('https://www.instagram.com/accounts/emailsignup/');
// Wait for the page to load.
$wait = new \Facebook\WebDriver\WebDriverWait($driver, 10);
$wait->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::name('emailOrPhone')));
// Generate a random username and password.
$username = 'testuser' . rand(1, 100000);
$password = 'testpass' . rand(1, 100000);
// Fill out the signup form with the generated username and password.
$driver->findElement(WebDriverBy::name('emailOrPhone'))->sendKeys($username);
$driver->findElement(WebDriverBy::name('fullName'))->sendKeys('John Doe');
$driver->findElement(WebDriverBy::name('username'))->sendKeys($username);
$driver->findElement(WebDriverBy::name('password'))->sendKeys($password);
// Click the signup button.
$signup_button = $driver->findElement(WebDriverBy::xpath("//button[@type='submit' and text()='Sign up']"));
$driver->executeScript("arguments[0].scrollIntoView(true);", array($signup_button));
$signup_button->click();
// Wait for the account creation process to complete.
$wait->until(WebDriverExpectedCondition::urlContains('/accounts/'));
// Take a screenshot of the created account profile.
$driver->get('https://www.instagram.com/' . $username);
sleep(3);
$driver->takeScreenshot('profile.png');
// Close the browser.
$driver->quit();
// Print the generated username and password.
echo $username . ' ' . $password;
کد سوم به زبان پایتون
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
import time
import random
# Specify path to the Chrome driver executable file.
# You can download it from here: https://sites.google.com/a/chromium.org/chromedriver/downloads
driver_path = '/path/to/chromedriver'
# Start the Chrome browser.
options = webdriver.ChromeOptions()
options.add_argument('--disable-extensions')
options.add_argument('--profile-directory=Default')
options.add_argument("--incognito")
options.add_argument("--disable-plugins-discovery")
options.add_argument("--start-maximized")
driver = webdriver.Chrome(executable_path=driver_path, options=options)
# Go to the Instagram signup page.
driver.get('https://www.instagram.com/accounts/emailsignup/')
# Wait for the page to load.
WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.NAME, 'emailOrPhone')))
# Generate a random username and password.
username = 'testuser' + str(random.randint(1, 100000))
password = 'testpass' + str(random.randint(1, 100000))
# Fill out the signup form with the generated username and password.
driver.find_element(By.NAME, 'emailOrPhone').send_keys(username)
driver.find_element(By.NAME, 'fullName').send_keys('John Doe')
driver.find_element(By.NAME, 'username').send_keys(username)
driver.find_element(By.NAME, 'password').send_keys(password)
# Click the signup button.
signup_button = driver.find_element(By.XPATH, "//button[@type='submit' and text()='Sign up']")
ActionChains(driver).move_to_element(signup_button).click().perform()
# Wait for the account creation process to complete.
WebDriverWait(driver, 20).until(EC.url_contains('/accounts/'))
# Take a screenshot of the created account profile.
driver.get('https://www.instagram.com/' + username)
time.sleep(3)
driver.save_screenshot('profile.png')
# Close the browser.
driver.quit()
# Print the generated username and password.
print(username, password)
اگه سوالی دارین توی قسمت کامنت ها بپرسین