commit 0da6afa7b870656d578ba1d99312d5c9c500d2a1 from: Aleksey Ryndin date: Thu Oct 03 16:55:06 2024 UTC Add: HTTP url for media as title commit - 5910837c1baffd8bc98558f37d738c3aaaf32b9d commit + 0da6afa7b870656d578ba1d99312d5c9c500d2a1 blob - 394e909b2070bf2b4d73d12db4e707c48849fa23 blob + c8a3bf5380a3d1d609c93b1ce973f2b573d7ab9b --- lonk.py +++ lonk.py @@ -138,7 +138,7 @@ class HtmlToGmi(HTMLParser): img_url = urljoin(self.base_url, src) mime, _ = guess_type(img_url) img_url = self.fn_media_url(mime, img_url) - self.gmi_text.append(f"=> {img_url} {title}") + self.gmi_text.append(f"=> {img_url} {title or img_url}") elif tag == "br": if self.stack: self.gmi_text.append(self.stack[-1].flush()) @@ -450,7 +450,7 @@ def print_gethonks(gethonks_answer, lonk_url, honk_url for donk in honk.get("Donks") or []: donk_url = honk_url.build_url(path=f'/d/{donk["XID"]}') if donk.get("XID") else donk["URL"] donk_mime, donk_text = donk["Media"], donk.get("Desc") or donk.get("Name") or None - lines.append(f'=> {lonk_url.media(donk_mime, donk_url)}') + lines.append(f'=> {lonk_url.media(donk_mime, donk_url)} {donk_url}') if donk_text: lines.append(donk_text) print("\r\n".join(lines))