shine-jayakumar / insta-likecom-bot

Automates likes and comments on an instagram account or tag
MIT License
140 stars 30 forks source link

Emojis do not work in comments | Two feature requests #51

Open Skuwwy opened 1 year ago

Skuwwy commented 1 year ago

Hello, loving all the new updates. The bot works flawlessly! I have one issue and two feature suggestions.

I've noticed that the bot throws an error when a comment from the list is only emojis. For example "šŸ˜šŸ‘Œ".

Here's the error:

Traceback (most recent call last):
  File "C:\Users\Legion\AppData\Local\Programs\Python\Python310\lib\logging\__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
  File "C:\Users\Legion\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 92-94: character maps to <undefined>
Call stack:
  File "D:\InstaBot 2\insta-likecom-bot\instalikecombot.py", line 418, in <module>
    logger.info(f'[target: {target}] Commented: {random_comment}')
Message: '[target: #midjourney] Commented: šŸ˜šŸ‘ŒšŸ‘Œ'
Arguments: ()

Can this be fixed?

Suggestions:

I will keep this same thread to add other feature requests if I can think of any.

Keep up the amazing work on this!

shine-jayakumar commented 1 year ago

I am glad you find it useful.

Thank you for your kind words and suggestions. Keep them coming.

Skuwwy commented 1 year ago

Thanks @shine-jayakumar , looking forward to it!

Is there an existing function to simply let the bot go through my home feed and like a predefined number of posts? (Except sponsored)

YoussefEssalhi commented 1 year ago

@shine-jayakumar , Maybe this code will help solve the emoji problem :

text_element = driver_trader.find_element_by_xpath('xpath')
text = 'āšŖšŸ“¢šŸ˜†'

driver.execute_script("arguments[0].innerHTML = '{}'".format(text),text_element)
text_element.send_keys('.')
text_element.send_keys(Keys.BACKSPACE)

Reference : https://stackoverflow.com/questions/51706256/sending-emojis-with-seleniums-send-keys