steveseguin / social_stream

Consolidate your live social messaging streams and much more
http://socialstream.ninja/
GNU General Public License v3.0
645 stars 95 forks source link

Inquiring About striphtml and stripemoji #93

Closed as2648as closed 1 year ago

as2648as commented 1 year ago

Hello, I would like to inquire about the parameters &striphtml and &stripemoji.

  1. I believe the functionality of &striphtml and &stripemoji is to help users remove any HTML and emoji from chat messages. Is my understanding correct? The current test results do not seem to support this idea. As shown in the image below, the Twitch popout is what I would expect, but the dock.html is what is currently being displayed. image

  2. Building on the previous question, I observed in the developer tools that the message retrieval in twitch.js seems to include html elements, which can affect the functionality of stripHtmlFunction when &striphtml is enabled but &stripemoji is not. This is because stripHtmlFunction removes html elements, but Twitch and Youtube's emojis are presented using <img>. image

  3. We can use this post for the stripemoji parameter and add code to check for <img> elements to more accurately replace emoji elements.

steveseguin commented 1 year ago

Using the following in Twitch /w BTTV: asdfasdfasd❤️‍🔥 sdfgsdfg :( gdsfgsdfg

stripemoji + striphtml: image

stripemoji: image

striphtml image

nothing added: image

The unhappy face is replaced by an Image by BTTV, and that gets removed with using &striphtml. I do not know if an image is an emoji or something else.

An emoji when using &stripemoji is a non-alphanumeric unicode character, representing an image, but not HTML. -- it's just text. Some fonts render emojis right; some don't.

To get rid of both images and text-based emojis, you'd need to use striphtml + stripemoji. It seems to work in my testing.

I'm open to considering treating all images as emojis, but I don't assume that in this case.

as2648as commented 1 year ago

Okay, I misunderstood the purpose of these features at first.
Perhaps in the future, I will add or modify some text processing features in a new branch, such as:

The reason I want to make these improvements is that some people may not want many graphics in the chat room after using emote.html.
In addition, having more options means users can choose what they need more flexibly. Looking forward to your reply.

By the way, as far as I know, "emoji", "emoticon", and "emotes" have different meanings in English.
Perhaps my choice of words may cause confusion, sorry about that.

as2648as commented 1 year ago

@steveseguin I've implemented the features mentioned in the latest comment and written some code for it. Since it's easier to test on custom.js and these features may not be merged into the main branch, I'm sharing my code here in hopes that it might inspire you with some ideas.

steveseguin commented 1 year ago

Thank you, kindly. I'll dig into it