forked from tmhlsky/Instagram-API-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_media.py
More file actions
45 lines (34 loc) · 1023 Bytes
/
Copy pathdelete_media.py
File metadata and controls
45 lines (34 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Use text editor to edit the script and type in valid Instagram username/password
#
# example delete_media
# this example for how to delete self media feed
# have 2 parameter on method deleteMedia( MediaID, MediaType)
from InstagramAPI import InstagramAPI
# change this username & password
username = 'your_username_here'
password = 'your_password_here'
ig = InstagramAPI(username, password)
# login
ig.login()
# get Self user feed
ig.getSelfUserFeed()
# get response json and assignment value to MediaList Variable
# dict type data
MediaList = ig.LastJson
# get first media for example delete media
Media = MediaList['items'][0]
# get media ID
MediaID = Media['id']
MediaType = Media['media_type']
# call deleteMedia Method
# deleteMedia return BOOL {true|false}
isDeleted = ig.deleteMedia(MediaID, media_type=MediaType)
if isDeleted:
print("Your Media {0} has been deleted".format(
MediaID
))
else:
print("Your Media Not Deleted")