import os from instauto import ApiClient from instauto import structs as st from instauto import post as ps if __name__ == '__main__': if os.path.isfile('./.instauto.save'): client = ApiClient.initiate_from_file('./.instauto.save') else: client = ApiClient(user_name=os.environ.get("INSTAUTO_USER") or "your_username", password=os.environ.get("INSTAUTO_PASS") or "your_password") client.login() client.save_to_disk('./.instauto.save') post = ps.Post.create(path='./test_story.jpg', source_type=st.WhereToPost.Feed, caption='This is an example. Follow me!') resp = client.post_post(post, 80) print("Success: ", resp.ok)
import os from instauto import ApiClient from instauto import profile as pr from instauto import structs as st if __name__ == '__main__': if os.path.isfile('./.instauto.save'): client = ApiClient.initiate_from_file('./.instauto.save') else: client = ApiClient(user_name=os.environ.get("INSTAUTO_USER") or "your_username", password=os.environ.get("INSTAUTO_PASS") or "your_password") client.login() client.save_to_disk('./.instauto.save') # FOR CUSTOM GENDER # p = ProfileSetGender.create( # gender=WhichGender.other, # custom_gender="Blue whale" # ) # FOR MALE / FEMALE / PREFER NOT TO SAY p = pr.SetGender.create(gender=st.WhichGender.male, ) client.profile_set_gender(p)
import os from instauto import ApiClient from instauto import friendships as fs if __name__ == '__main__': if os.path.isfile('./.instauto.save'): client = ApiClient.initiate_from_file('./.instauto.save') else: client = ApiClient(user_name=os.environ.get("INSTAUTO_USER") or "your_username", password=os.environ.get("INSTAUTO_PASS") or "your_password") client.login() client.save_to_disk('./.instauto.save') f = fs.Remove(user_id="38720650610") client.follower_remove(f)
import os from instauto import ApiClient from instauto import post as ps if __name__ == '__main__': if os.path.isfile('./.instauto.save'): client = ApiClient.initiate_from_file('./.instauto.save') else: client = ApiClient(user_name=os.environ.get("INSTAUTO_USER") or "your_username", password=os.environ.get("INSTAUTO_PASS") or "your_password") client.log_in() client.save_to_disk('./.instauto.save') caption = ps.UpdateCaption( media_id="1734612737423614055_6400760974", caption_text="This is an example for update caption post.") client.post_update_caption(caption)
import os from time import sleep import random from instauto import ApiClient from instauto import friendships as fs if __name__ == '__main__': if os.path.isfile('./.instauto.save'): client = ApiClient.initiate_from_file('./.instauto.save') else: client = ApiClient(user_name=os.environ.get("INSTAUTO_USER") or "your_username", password=os.environ.get("INSTAUTO_PASS") or "your_password") client.login() client.save_to_disk('./.instauto.save') f = fs.GetFollowing(user_id="2283025667") obj, result = client.following_get(f) # grabs the first page while result: # paginate until all users are extracted parsed = result.json() print(f"Extracted {len(parsed['users'])} users following") print( f"The username of the first extracted user following is {parsed['users'][0]['username']}" ) obj, result = client.following_get(obj) sleep(random.randint(10, 60))
import os from instauto import ApiClient from instauto import search as se from instauto import friendships as fs if __name__ == '__main__': if os.path.isfile('./.instauto.save'): client = ApiClient.initiate_from_file('./.instauto.save') else: client = ApiClient(user_name=os.environ.get("INSTAUTO_USER") or "your_username", password=os.environ.get("INSTAUTO_PASS") or "your_password") client.login() client.save_to_disk('./.instauto.save') s = se.Username.create("stan058_", 1) resp = client.search_username(s).json() user_id = resp['users'][0]['pk'] a = fs.ApproveRequest(user_id) resp = client.follow_request_approve(a)
import os from instauto import ApiClient from instauto import post as ps from instauto import search as se if __name__ == '__main__': if os.path.isfile('./.instauto.save'): client = ApiClient.initiate_from_file('./.instauto.save') else: client = ApiClient(user_name=os.environ.get("INSTAUTO_USER") or "your_username", password=os.environ.get("INSTAUTO_PASS") or "your_password") client.login() client.save_to_disk('./.instauto.save') s = se.Username.create('instagram', 1) resp = client.search_username(s).json() user = resp['users'][0] user_id = user['pk'] r = ps.RetrieveByUser.create(user_id) obj, result = client.post_retrieve_by_user(r) retrieved_items = [] # retrieve the first 20 posts while result and len(retrieved_items) < 20: retrieved_items.extend(result) obj, result = client.post_retrieve_by_user(obj) print(f"Retrieved {len(result)} new posts!") print(f"Retrieved a total of {len(retrieved_items)} posts!")
import os from instauto import ApiClient from instauto import friendships as fs if __name__ == '__main__': if os.path.isfile('./.instauto.save'): client = ApiClient.initiate_from_file('./.instauto.save') else: client = ApiClient(user_name="your_username", password="******") client.login() client.save_to_disk('./.instauto.save') p = fs.PendingRequests() users = client.follow_requests_get(p) for user in users: # approves all requests a = fs.ApproveRequest(str(user['pk'])) resp = client.follow_request_approve(a)