下载地址:http://m.pan38.com/download.php?code=ENROLN 提取码:3821
多平台支持:集成抖音、小红书、快手三大平台的自动化操作
模拟人类行为:包含随机鼠标移动、间隔点击、不规则停留时间等人性化设计
完整交互链:实现视频观看、点赞、评论、广告点击等养号必需操作
反检测机制:通过随机操作间隔和动态等待时间降低被封风险
可配置参数:支持自定义每个平台的操作时长和交互频率
import os
import time
import random
import pyautogui
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class SocialMediaBot:
def init(self):
self.driver = None
self.platform_config = {
'douyin': {
'url': 'https://www.douyin.com',
'login_xpath': '//[@id="login-pannel"]/div[2]/div[1]',
'video_xpath': '//[@id="root"]/div/div[2]/div[1]/div/div[1]/div[3]',
'ad_xpath': '//[@id="ads-container"]/div[1]'
},
'xiaohongshu': {
'url': 'https://www.xiaohongshu.com',
'login_xpath': '//[@id="global"]/div[1]/div[3]/div[2]',
'video_xpath': '//[@id="app"]/div[1]/div[2]/div[2]/div[1]',
'ad_xpath': '//[@id="__layout"]/div/div[2]/div[3]/div[1]'
},
'kuaishou': {
'url': 'https://www.kuaishou.com',
'login_xpath': '//[@id="login-btn"]',
'video_xpath': '//[@id="video-list"]/div[1]',
'ad_xpath': '//*[@id="ad-container"]/div[1]'
}
}
self.setup_driver()
def setup_driver(self):
chrome_options = Options()
chrome_options.add_argument("--window-size=1200,800")
chrome_options.add_argument("--disable-notifications")
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
self.driver = webdriver.Chrome(options=chrome_options)
def random_sleep(self, min_sec=2, max_sec=10):
time.sleep(random.randint(min_sec, max_sec))
def simulate_human_behavior(self):
# Random mouse movements
for _ in range(random.randint(3, 7)):
x = random.randint(100, 1000)
y = random.randint(100, 700)
pyautogui.moveTo(x, y, duration=random.uniform(0.3, 1.2))
self.random_sleep(0.5, 1.5)
def watch_video(self, platform, duration=60):
config = self.platform_config[platform]
self.driver.get(config['url'])
self.random_sleep(3, 8)
# Login simulation
try:
login_btn = WebDriverWait(self.driver, 15).until(
EC.presence_of_element_located((By.XPATH, config['login_xpath']))
)
login_btn.click()
self.random_sleep(5, 10) # Simulate manual login time
except:
print(f"Login element not found on {platform}")
start_time = time.time()
while time.time() - start_time < duration:
# Watch video
try:
video = WebDriverWait(self.driver, 15).until(
EC.presence_of_element_located((By.XPATH, config['video_xpath']))
)
video.click()
watch_time = random.randint(15, 45)
print(f"Watching video for {watch_time} seconds")
time.sleep(watch_time)
# Random interactions
if random.random() > 0.7:
pyautogui.press('l') # Simulate like
print("Liked the video")
self.random_sleep(1, 3)
if random.random() > 0.8:
pyautogui.hotkey('shift', 'c') # Simulate comment
self.random_sleep(1, 2)
pyautogui.typewrite(random.choice(['Nice!', 'Awesome', '666']))
self.random_sleep(1, 2)
pyautogui.press('enter')
print("Commented on the video")
# Watch ad occasionally
if random.random() > 0.6:
try:
ad = WebDriverWait(self.driver, 5).until(
EC.presence_of_element_located((By.XPATH, config['ad_xpath']))
)
ad.click()
print("Watching ad for 10-20 seconds")
self.random_sleep(10, 20)
except:
pass
# Scroll to next video
pyautogui.scroll(-random.randint(300, 800))
self.random_sleep(2, 5)
self.simulate_human_behavior()
except Exception as e:
print(f"Error during video watching: {str(e)}")
self.driver.refresh()
self.random_sleep(5, 10)
def run(self, platforms, duration_per_platform=300):
try:
for platform in platforms:
print(f"Starting {platform} automation")
self.watch_video(platform, duration_per_platform)
print(f"Finished {platform} session")
self.random_sleep(10, 20)
finally:
self.driver.quit()
if name == "main":
bot = SocialMediaBot()
bot.run(['douyin', 'xiaohongshu', 'kuaishou'], duration_per_platform=600)