Вот несколько методов, которые можно использовать для достижения этой цели, а также примеры кода:
Метод 1: использование Omlet Arcade API
import requests
def stop_following_user(user_id):
api_url = f"https://api.omlet.me/users/{user_id}/follow"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
}
response = requests.delete(api_url, headers=headers)
if response.status_code == 200:
print("Successfully stopped following the user.")
else:
print("Failed to stop following the user.")
# Usage
user_id = "123456789" # Replace with the user ID you want to stop following
stop_following_user(user_id)
Метод 2: использование Selenium WebDriver
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def stop_following_user(username, password, user_id):
driver = webdriver.Chrome("path/to/chromedriver") # Replace with the path to your chromedriver executable
driver.get("https://www.omlet.gg/")
# Login
username_field = driver.find_element(By.ID, "username_input")
password_field = driver.find_element(By.ID, "password_input")
login_button = driver.find_element(By.ID, "login_button")
username_field.send_keys(username)
password_field.send_keys(password)
login_button.click()
# Navigate to user's profile
profile_url = f"https://www.omlet.gg/user/{user_id}"
driver.get(profile_url)
# Unfollow the user
unfollow_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//button[contains(text(), 'Unfollow')]")))
unfollow_button.click()
driver.quit()
# Usage
username = "your_username"
password = "your_password"
user_id = "123456789" # Replace with the user ID you want to stop following
stop_following_user(username, password, user_id)
Не забудьте заменить заполнители своими учетными данными и данными.