Created
January 22, 2020 02:39
-
-
Save kevinjnguyen/44c1f40c3c27be5ef1f33422d36211bd to your computer and use it in GitHub Desktop.
Scripting all together the get hashtag instaloader.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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