Skip to content

Instantly share code, notes, and snippets.

@samyakb
Forked from Suleman-Elahi/unsaver.py
Created December 16, 2021 09:10
Show Gist options
  • Select an option

  • Save samyakb/18b787d814f72be9c93e556cb917cf34 to your computer and use it in GitHub Desktop.

Select an option

Save samyakb/18b787d814f72be9c93e556cb917cf34 to your computer and use it in GitHub Desktop.
Sript to unsave all saved Instagram posts. Uses Instagram private API by ping and its extensions to do the heavy lifting.
from instagram_private_api import Client, ClientCompatPatch
from instagram_private_api_extensions import pagination
import json, time
user_name = 'UserName'
password = 'PassWord'
api = Client(user_name, password)
items=[]
for results in pagination.page(api.saved_feed, args={}):
if results.get('items'):
items.extend(results['items'])
print("Starting unsaving posts.....")
for i,x in enumerate(items):
z = items[i]['media']['pk']
api.unsave_photo(media_id=z)
time.sleep(1)
print("Unsaved: ", z)
@samyakb
Copy link
Author

samyakb commented May 19, 2022

- pip install git+https://git@github.com/ping/instagram_private_api.git@1.6.0
- pip install git+https://git@github.com/ping/instagram_private_api_extensions.git@0.3.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment