Can you save the name of the profiles that post with a hashtag?
Yes,of course you can.
Just use function get_hashtag_users to scrape them and then save the names in a .txt file.
This should work:
import argparse
import os
import sys
sys.path.append(os.path.join(sys.path[0], '../'))
from instabot import Bot
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument('-u', type=str, help="username")
parser.add_argument('-p', type=str, help="password")
parser.add_argument('-proxy', type=str, help="proxy")
parser.add_argument('hashtags', type=str, nargs='+', help='hashtags')
args = parser.parse_args()
bot = Bot()
bot.login(username=args.u, password=args.p,
proxy=args.proxy)
for hashtag in args.hashtags:
users = bot.get_hashtag_users(hashtag)
for user in users:
file = open('database.txt','a+')
file.write(user)
file.write("\n")
did not work :( @Talebano
@iransales all work, all users_id saved in database.txt, for save usernames change line file.write(user) to file.write(bot.get_username_from_user_id(user))
Yeah @ademaro is right.
But anyway if I was you @iransales I'd rather use the ids and not the username,because our bot works with ids..you'll be in need of converting them later I think.
Close this issue,problem has been solved
This works great but only dumps 64 users. Is it possible to manually give it a limit of xxx?
How can I run your script , Can I run through Ubuntu Terminal?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
@iransales all work, all users_id saved in
database.txt, for save usernames change linefile.write(user)tofile.write(bot.get_username_from_user_id(user))