sur950 / any_link_preview

A flutter Plugin/Package to show the preview of any web link that starts with HTTP/HTTPS. Mostly useful for application that had chat.
MIT License
70 stars 70 forks source link

Can't get domain name of websites #39

Closed Helocominc closed 1 year ago

Helocominc commented 1 year ago

Add the option to get domain name of the website url in metadata. Instead of displaying the full url just show the domain. Issue

This is the expected domain sample expected

LeGoffMael commented 1 year ago

You can do that on your side as well

String getUrlHost(String url) {
  Uri uri = Uri.parse(url);
  return uri.host.replaceFirst(RegExp(r"^www."), '');
}
Helocominc commented 1 year ago

Okay thanks. I will try that.

sur950 commented 1 year ago

Hi @Helocominc

We are not rendering the title, or body manually. Whatever the meta-data is giving us, we are rendering the same. I guess for youtube videos, it is giving full length instead of just the domain name or some description.

You can always use your method to fetch meta-data and render your own UI by using the above-mentioned helper function. Thanks for helping the community @LeGoffMael

Regards, Suresh