import instagrapi import random import time class InstagramBot: def init(self, username,…
- User
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! 👍”, ]
- Assistant
- User
Traceback (most recent call last): File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in start(fakepyfile,mainpyfile) File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start exec(open(mainpyfile).read(), main.dict) File "", line 79, in AttributeError: 'Client' object has no attribute 'is_logged_in'
[Program finished]
- Assistant
The error message you encountered,
AttributeError: 'Client' object has no attribute 'is_logged_in', indicates that theis_logged_inattribute doesn't exist for theClientobject in theinstagrapilibrary. This attribute was assumed to be part of the library based on the context provided, but it appears my assumptions were incorrect.