meyt/linkpreview

Absolute image returning wrong image path when image has a relative path

hendrikschneider opened this issue · 1 comments

Hello,

in the following url is a relative path used for the image: https://www.wirtschaftsfoerderung-hannover.de/de/Veranstaltungen/hannoverimpuls/Dos_and_Donts_des_E-Commerce.php/medien/bilder/hannoverimpuls/Logos/Screenshot_2022-10-18_121717_0.png

from linkpreview import link_preview
preview = link_preview("https://www.wirtschaftsfoerderung-hannover.de/de/Veranstaltungen/hannoverimpuls/Dos_and_Donts_des_E-Commerce.php/medien/bilder/hannoverimpuls/Logos/Screenshot_2022-10-18_121717_0.png")

preview.image
# /medien/bilder/hannoverimpuls/Logos/Screenshot_2022-10-18_121717_0.png?m=1666088811&

preview.absolute_image
# https://www.wirtschaftsfoerderung-hannover.de/de/Veranstaltungen/hannoverimpuls/Dos_and_Donts_des_E-Commerce.php/medien/bilder/hannoverimpuls/Logos/Screenshot_2022-10-18_121717_0.png/medien/bilder/hannoverimpuls/Logos/Screenshot_2022-10-18_121717_0.png?m=1666088811&

Expected result:

preview.absolute_image
# https://www.wirtschaftsfoerderung-hannover.de/medien/bilder/hannoverimpuls/Logos/Screenshot_2022-10-18_121717_0.png?m=1666088811&

A library such as tld extract could be helpful to retrieve the domain of a path but it also introduces a new depency.

Thanks for the fast support!