robvanderleek / mudslide

Send WhatsApp messages from the command-line 📯
ISC License
152 stars 17 forks source link

Feature Request: URL preview #113

Closed ThisIsTheOnlyUsernameAvailable closed 6 days ago

ThisIsTheOnlyUsernameAvailable commented 2 months ago

Fantastic app. Thanks for your work on it.

I have a feature request that I think would be valuable for a broad audience. It'd be really nice to include URL previews if a message contains a link. Currently links sent from Mudslide are just the raw text:

However if you paste a link in the native WhatsApp client, it'll generate a preview:

I believe Baileys has the capability to include the preview.

Is this something that can be included?

create-issue-branch[bot] commented 2 months ago

Branch issue-113-Feature_Request_URL_preview created!

robvanderleek commented 2 months ago

Hi @ThisIsTheOnlyUsernameAvailable

According to the Baileys documentation, link previews should be enabled when the link-preview-js library is added as a dependency to a project.

I've done this in branch issue-113-Feature_Request_URL_preview but it doesn't seem to work for all cases.

For example, it works for GitHub repos:

npx -y robvanderleek/mudslide#issue-113-Feature_Request_URL_preview send me 'https://github.com/robvanderleek/mudslide'

But does not work for the IMDB example:

npx -y robvanderleek/mudslide#issue-113-Feature_Request_URL_preview send me 'https://imdb.com/title/tt0098904'

Please try yourself and let me know if this improves your use-case or not.

ThisIsTheOnlyUsernameAvailable commented 1 month ago

Thanks very much, @robvanderleek! I will test in the coming couple of days.

ThisIsTheOnlyUsernameAvailable commented 1 month ago

Thanks again for your work on including this functionality, @robvanderleek . I've now had a chance to test and have some feedback. I'm ignoring the imdb issue as it seems like it's the only URL that isn't working for me, so I'm assuming it's site-specific.

It seems that the preview parses the site heading, but does not include the image rendering. For example, the following shows the same link sent from the native WA client, and then from Mudslide:

good-bad

The above is the same for other sites too:

Native versus mudslide2

I've seen a ticket talking about image sizing for the preview so understand that an image should be generated.

Do you see the same?

robvanderleek commented 1 month ago

Hi @ThisIsTheOnlyUsernameAvailable

I've added some extra code from the issue you mentioned, can you try again?

For me, on iOS WA client, the images do render (both with and without the extra code mentioned above): Schermafbeelding 2024-09-17 om 09 27 58 jpeg

What platform is your client running on?

ThisIsTheOnlyUsernameAvailable commented 1 month ago

I'm using Android and am not seeing the previews. However it looks like this is a known bug: https://github.com/WhiskeySockets/Baileys/issues/347

Thanks for your implementation of the feature; I really appreciate it. I'll see if I can get it fixed upstream.

github-actions[bot] commented 1 week 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.