ohld / igbot

🐙 Free scripts, bots and Python API wrapper. Get free followers with our auto like, auto follow and other scripts!
https://hikerapi.com/p/N2P6iqiM
Apache License 2.0
4.69k stars 1.47k forks source link

Many problems with my script #327

Closed zbagdzevicius closed 6 years ago

zbagdzevicius commented 7 years ago

[ + ] Bug report (encountered problems/errors) Python 3.6.2 (v3.6.2:5fd33b5)

Code: import . . . bot=Bot(. . . ) random_user_file = bot.read_list_from_file('user.txt') random_hashtag_file = bot.read_list_from_file('hashtag.txt') random_geotag_file = bot.read_list_from_file('geotag.txt') direct_advertise = bot.read_list_from_file('direct.txt') hashtag_advertise = bot.read_list_from_file('adhashtag.txt')

def get_random(from_list): _random = random.choice(from_list) print("Pasirenkamas atsitiktinis elementas: \n" + _random + "\n") return _random def l_tag(): bot.like_hashtag(get_random(random_hashtag_file)) def l_followers(): bot.like_followers(get_random(random_user_file)) def f_followers(): bot.follow_followers(get_random(random_user_file)) def f_tag(): bot.follow_users(bot.get_hashtag_users(get_random(random_hashtag_file))) def c_tag(): bot.comment_hashtag(get_random(random_hashtag_file)) def direct_messages(): bot.send_messages(direct_advertise, get_random(bot.get_hashtag_users(get_random(hashtag_advertise)))) def run_threaded(job_fn): job_thread = threading.Thread(target=job_fn) job_thread.start() def test(): Thread(target=direct_messages).start() 1st bug Thread(target=l_tag).start() 2nd bug Thread(target=l_followers).start() ok Thread(target=f_followers).start() ok Thread(target=f_tag).start() ok Thread(target=c_tag).start() 3rd bug print("bot started") while True: schedule.run_pending() time.sleep(1)

bot.login() test()

bot = Bot() followers = bot.get_user_followers(bot.user_id)



Error/Debug Log:

1st bug:
            messages send to random or non-existing persons including myself

2nd bug:
--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\logging\__init__.py", line 994, in emit
    stream.write(msg)
  File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\encodings\cp1257.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\ufeff' in position 58: character maps to <undefined>
Call stack:
  File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\threading.py", line 884, in _bootstrap
    self._bootstrap_inner()
  File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:/Users/PC/Desktop/instabot/examples/1botas.py", line 78, in l_tag
    def l_tag(): bot.like_hashtag(get_random(random_hashtag_file))
  File "C:\Users\PC\Desktop\instabot\instabot\bot\bot.py", line 311, in like_hashtag
    return like_hashtag(self, hashtag, amount)
  File "C:\Users\PC\Desktop\instabot\instabot\bot\bot_like.py", line 63, in like_hashtag
    self.logger.info("Going to like media with hashtag #%s." % hashtag)
Message: 'Going to like media with hashtag #\ufeffkaunas.'
Arguments: ()
2017-09-09 16:23:24,885 - WARNING - Request return 404 error!
2017-09-09 16:23:24,888 - WARNING - Error while getting hashtag feed.
2017-09-09 16:23:24,889 - INFO - Nothing to like.

            randomly inserting \ufeff before all hashtags

3rd bug:
--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\logging\__init__.py", line 994, in emit
    stream.write(msg)
  File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\encodings\cp1257.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\ufeff' in position 45: character maps to <undefined>
Call stack:
  File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\threading.py", line 884, in _bootstrap
    self._bootstrap_inner()
  File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:/Users/PC/Desktop/instabot/examples/1botas.py", line 96, in c_tag
    def c_tag(): bot.comment_hashtag(get_random(random_hashtag_file))
  File "C:\Users\PC\Desktop\instabot\instabot\bot\bot.py", line 434, in comment_hashtag
    return comment_hashtag(self, hashtag, amount)
  File "C:\Users\PC\Desktop\instabot\instabot\bot\bot_comment.py", line 49, in comment_hashtag
    return self.comment_medias(medias[:amount])
  File "C:\Users\PC\Desktop\instabot\instabot\bot\bot.py", line 437, in comment_medias
    return comment_medias(self, medias)
  File "C:\Users\PC\Desktop\instabot\instabot\bot\bot_comment.py", line 36, in comment_medias
    self.logger.info("Commented with text: %s" % text)
Message: 'Commented with text: \ufeffSveiki ! Ar norėtumėte praplėsti savo instagram sekėjų ratą? Tuomet turėtumėte užsukti į mūsų puslapį ir sužinoti daugiau apie mūsų veiklą. Su pagarba, @armadillo.lt komanda.'
Arguments: ()

                                              \uffef before comment
stale[bot] commented 6 years ago

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.

itamarZ3 commented 5 years ago

For the ufeff problem: Open the file you're reading, hashtag.txt, for example Go to Save As... In coding, select ANSI Save it, it will ask you to overwrite, click yes

I had this issue and this solution solved it, hope it helps.