Skip to content

Instantly share code, notes, and snippets.

@kevinjnguyen
Created January 22, 2020 02:39
Show Gist options
  • Save kevinjnguyen/44c1f40c3c27be5ef1f33422d36211bd to your computer and use it in GitHub Desktop.
Save kevinjnguyen/44c1f40c3c27be5ef1f33422d36211bd to your computer and use it in GitHub Desktop.
Scripting all together the get hashtag instaloader.
import threading
from instaloader import Instaloader, Profile
import engagement
import pickle
loader = Instaloader()
NUM_POSTS = 10
def get_hashtags_posts(query):
posts = loader.get_hashtag_posts(query)
users = {}
count = 0
for post in posts:
profile = post.owner_profile
if profile.username not in users:
summary = engagement.get_summary(profile)
users[profile.username] = summary
count += 1
print('{}: {}'.format(count, profile.username))
if count == NUM_POSTS:
break
return users
if __name__ == "__main__":
hashtag = "tacos"
users = get_hashtags_posts(hashtag)
print(users)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment