fix: add logging for fetching telegraph page and handle image URLs from telegra.ph

This commit is contained in:
krau
2025-10-06 22:13:41 +08:00
parent 76a82a38ee
commit 0e989cc1a6
2 changed files with 6 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package tphutil
import (
"encoding/json"
"strings"
"github.com/krau/SaveAny-Bot/config"
"github.com/krau/SaveAny-Bot/pkg/telegraph"
@@ -41,6 +42,10 @@ func GetNodeImages(node telegraph.Node) []string {
if nodeElement.Tag == "img" {
if src, exists := nodeElement.Attrs["src"]; exists {
if strings.HasPrefix(src, "/file/") {
// handle images on telegra.ph server
src = "https://telegra.ph" + src
}
srcs = append(srcs, src)
}
}