import instagrapi
import random
import time

class InstagramBot:
    def __init__(self, username, password):
        self.settings = {
            "uuids": {
                "phone_id": "57d64c41-a916-3fa5-bd7a-3796c1dab122",
                "uuid": "8aa373c6-f316-44d7-b49e-d74563f4a8f3",
                "client_session_id": "6c296d0a-3534-4dce-b5aa-a6a6ab017443",
                "advertising_id": "8dc88b76-dfbc-44dc-abbc-31a6f1d54b04",
                "device_id": "android-e021b636049dc0e9"
            },
            "cookies":  {},  # set here your saved cookies
            "last_login": 1596069420.0000145,
            "device_settings": {
                "cpu": "h1",
                "dpi": "640dpi",
                "model": random.choice(["Galaxy S10", "iPhone X", "Pixel 4"]),
                "device": random.choice(["SM-G973F", "SM-G960F", "SM-G988U"]),
                "resolution": "1440x2392",
                "app_version": "117.0.0.28.123",
                "manufacturer": random.choice(["Samsung", "Apple", "Google"]),
                "version_code": "168361634",
                "android_release": random.choice(["9", "10", "11"]),
                "android_version": 29
            },
            "user_agent": "Instagram 117.0.0.28.123 Android (23/6.0.1; ...US; 168361634)"
        }
        self.client = instagrapi.Client(self.settings)
        self.client.login(username, password)

    def interact_with_hashtags(self, hashtags, like_limit=10, comments=[]):
        “”“
        التفاعل مع منشورات بناءً على قائمة الهاشتاغات المحددة.
        “””
        for hashtag in hashtags:
            print(f"Processing #{hashtag}…“)
            medias = self.client.hashtag_medias_recent(hashtag, amount=100)
            liked_count = 0
            for media in medias:
                if liked_count >= like_limit:
                    break
                try:
                    print(f"Liking {media.id}”)
                    self.client.media_like(media.id)
                    liked_count += 1
                    if comments:
                        comment = random.choice(comments)
                        print(f"Commenting on {media.id}: {comment}“)
                        self.client.media_comment(media.id, comment)
                    time.sleep(random.randint(2, 5))  # تجنب الحظر بتسريع البرنامج
                except Exception as e:
                    print(f"Failed to interact with {media.id}: {e}”)
            time.sleep(random.randint(5, 10))

    # الوظائف الأخرى للبوت...

# إعداد البوت
bot = InstagramBot('aria_nda41', 'poiuy12345')

# التأكد من تسجيل الدخول والمعلومات
if bot.client.is_logged_in:
    print("Logged in successfully.")
else:
    print("Failed to log in. Please check your username and password.")

# هاشتاغات للتفاعل معها
hashtags = ["travel", "nature", "photography"]

# هاشتاغات قوية جديدة
important_hashtags = [
    "#ArtificialArt",
    "#AIart",
    "#DigitalArt",
    "#CreativeAI",
    "#GenerativeArt",
    "#NaturePhotography",
    "#ArtificialIntelligenceArt",
    "#ComputerGeneratedArt",
    "#AIphotography",
    "#ArtificialCreativity"
]

# التعليقات
comments = [
    “Amazing shot! 📸”,
    “Love this place! 💙”,
    “Incredible! ✨”,
    “This is a great shot! 📷”,
    “I love this photo! ❤️”,
    “Wow, amazing! 😮”,
    “This is beautiful! 😍”,
    “What a stunning view! 🌄”,
    “This is breathtaking! 🤩”,
    “Great job! 👍”,
]

# بدء التفاعل
while True:
    bot.interact_with_hashtags(hashtags, like_limit=10, comments=comments)
    bot.follow_users_with_hashtag("ai", 10)
    bot.unfollow_nonfollowers()
    bot.follow_users_by_hashtags(important_hashtags, follow_limit=10)
    bot.comment_on_hashtags(important_hashtags, comment_limit=10)
    bot.unfollow_non_interactive_users(days=30, unfollow_limit=10)
    # تشغيل البوت مع إيقاف لمدة يوم قبل التكرار
    time.sleep(60 * 60 * 24)
صحح هذا السكريبت بدون اي تعليقات أو نصائح منك  باستخدام هذا المستند https://subzeroid.github.io/instagrapi/usage-guide/interactions.html