mirror of
https://github.com/instaloader/instaloader.git
synced 2024-11-04 09:22:29 +01:00
ae492ed68b
Presents code examples that use the instaloader module for more advanced tasks than what is possible with the Instaloader command line interface. Presents #46, #56, #110, #113, #120, #121.
28 lines
695 B
Python
28 lines
695 B
Python
import instaloader
|
|
|
|
L = instaloader.Instaloader()
|
|
|
|
USER = 'your_account'
|
|
PROFILE = USER
|
|
|
|
# Your preferred way of logging in:
|
|
L.load_session_from_file(USER)
|
|
|
|
profile = instaloader.Profile.from_username(L.context, PROFILE)
|
|
|
|
likes = set()
|
|
print('Fetching likes of all posts of profile {}.'.format(profile.username))
|
|
for post in profile.get_posts():
|
|
print(post)
|
|
likes = likes | set(post.get_likes())
|
|
|
|
print('Fetching followers of profile {}.'.format(profile.username))
|
|
followers = set(profile.get_followers())
|
|
|
|
ghosts = followers - likes
|
|
|
|
print('Storing ghosts into file.')
|
|
with open('/YOUR PATH/inactive-users.txt', 'w') as f:
|
|
for ghost in ghosts:
|
|
print(ghost.username, file=f)
|