Search code examples
pythondjangoapi-linkpreview

How to add link previews in django?


I'm doing a chat app in python Django and I Want to implement Link preview while typing that ink in chat box. Anybody familiar with this please help.


Solution

  • You can use a Link preview API service - [1]: https://www.linkpreview.net/ Try this code .

    $.ajax({
                url: "https://api.linkpreview.net",
                dataType: 'jsonp',
                data: {q: "message URL", key: 'your API key'},
                success: function (response) {
                    let data=response;        
                    console.log(data);
                }
            });