import asyncio from playwright.async_api import async_playwright async def auto_react(email, password): async with async_playwright() as p: browser = await p.chromium.launch(headless=False) page = await browser.new_page() await page.goto("https://www.facebook.com") await page.fill('input[name="email"]', email) await page.fill('input[name="pass"]', password) await page.click('button[name="login"]') await page.wait_for_timeout(8000) # الذهاب إلى الصفحة الرئيسية أو أي صفحة/مجموعة await page.goto("https://www.facebook.com/") await page.wait_for_timeout(5000) posts = await page.query_selector_all("div[role='feed'] div[data-ad-preview='message']") for i, post in enumerate(posts[:5]): try: like_button = await post.query_selector("div[aria-label='أعجبني']") if like_button: await like_button.click() await page.wait_for_timeout(1000) except: continue await browser.close() print("تم التفاعل مع المنشورات.") if __name__ == "__main__": email = input("Email: ") password = input("Password: ") asyncio.run(auto_react(email, password)) import asyncio from playwright.async_api import async_playwright async def auto_react(email, password): try: async with async_playwright() as p: browser = await p.chromium.launch(headless=False) page = await browser.new_page() # تسجيل الدخول await page.goto("https://www.facebook.com") await page.fill('input[name="email"]', email) await page.fill('input[name="pass"]', password) await page.click('button[name="login"]') await page.wait_for_timeout(8000) # الانتقال إلى الصفحة الرئيسية await page.goto("https://www.facebook.com/") await page.wait_for_timeout(5000) # اختيار المنشورات posts = await page.query_selector_all("div[role='feed'] div[data-ad-preview='message']") for i, post in enumerate(posts[:5]): try: like_button = await post.query_selector("div[aria-label='أعجبني']") if like_button: await like_button.click() print(f"تم التفاعل مع المنشور رقم {i + 1}") await page.wait_for_timeout(1000) except Exception as e: print(f"تجاوز منشور رقم {i + 1} بسبب خطأ: {e}") continue print("تم التفاعل مع المنشورات بنجاح!") await browser.close() except Exception as main_error: print(f"حدث خطأ أثناء تنفيذ السكربت: {main_error}") if __name__ == "__main__": email = input("Email: ") password = input("Password: ") asyncio.run(auto_react(email, password))