Scrap more things

This commit is contained in:
LittleSheep 2024-08-19 19:05:47 +08:00
parent 93171bf48c
commit a8330a81f4
2 changed files with 10 additions and 1 deletions

View File

@ -6,8 +6,11 @@ type LinkMeta struct {
Entry string `json:"entry_id" gorm:"uniqueIndex"`
Icon string `json:"icon"`
URL string `json:"url"`
Image *string `json:"image"`
Title *string `json:"title"`
Image *string `json:"image"`
Video *string `json:"video"`
Audio *string `json:"audio"`
Description *string `json:"description"`
SiteName *string `json:"site_name"`
Type *string `json:"type"`
}

View File

@ -77,6 +77,12 @@ func LinkExpand(target string) (*models.LinkMeta, error) {
meta.Image = lo.ToPtr(e.Attr("content"))
case "og:video":
meta.Video = lo.ToPtr(e.Attr("content"))
case "og:audio":
meta.Audio = lo.ToPtr(e.Attr("content"))
case "og:site_name":
meta.SiteName = lo.ToPtr(e.Attr("content"))
case "og:type":
meta.Type = lo.ToPtr(e.Attr("content"))
}
})
c.OnHTML("link[rel]", func(e *colly.HTMLElement) {