'Can we filter out just the domain name from a link in a TextField object using urlize and a custom method?

Is it possible to use urlize and a custom filtering method in a TextField object to filter out the domain part of the URL, leaving the suffix and the prefix? For example: in, "hey this is a link https://www.google.com" we filter it out and the result looks something like this "hey this is a link google". I would really appreciate it if someone can help, thx!

template

{% for blog in blog %}
    <div class="description">{{ blog.description | urlizetrunc:20 }}</div>
{% endfor %}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source