Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Skuwwy opened this issue Apr 15, 2023 · 3 comments
Open

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

Skuwwy opened this issue Apr 15, 2023 · 3 comments

Comments

@Skuwwy
Copy link

Skuwwy commented Apr 15, 2023

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:

  • Is there a way to prevent the bot from commenting on the same user more than once when exploring hashtags? Or does it already do this?
  • This may seem weird but I would like the bot to avoid interacting with posts with certain hashtags that can be defined in a text file.

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

Keep up the amazing work on this!

@Skuwwy Skuwwy changed the title Emojis do not work in comments | Avoid same user from explore page Emojis do not work in comments | Two feature requests Apr 15, 2023
@shine-jayakumar
Copy link
Owner

I am glad you find it useful.

  • Issue with emojis has been addressed earlier. The underlying driver throws this error when it encounters certain emojis. It has to do with encoding issues when sending text (with certain emjois) to a textarea on Chrome. Firefox doesn't have this problem, however, I've put a hold on development for Firefox for some time. I will revist the encoding issue with emjois soon.

  • Not commenting on the same user more than once - this would be a good addition

  • Avoid interacting with posts containing certain tags - currently the --matchtag, --matchtagnum can be used to filter out posts based on the tags. Although, adding this option seems totally logical.

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

@Skuwwy
Copy link
Author

Skuwwy commented Apr 21, 2023

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
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants