goscraper
Version 1
Golang軟件包要快速返回網頁的預覽,您可以輕鬆獲得其標題,描述和圖像
func main() {
s, err := goscraper.Scrape("https://www.w3.org/", 5)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("Icon : %sn", s.Preview.Icon)
fmt.Printf("Name : %sn", s.Preview.Name)
fmt.Printf("Title : %sn", s.Preview.Title)
fmt.Printf("Description : %sn", s.Preview.Description)
fmt.Printf("Image: %sn", s.Preview.Images[0])
fmt.Printf("Url : %sn", s.Preview.Link)
}
輸出:
圖標: https://www.w3.org/favicon.ico
名稱: www.w3.org
標題:萬維網聯盟(W3C)
描述:萬維網聯盟(W3C)是一個國際社會,成員組織,全職員工和公眾共同努力以製定網絡標準。
圖片: https://www.w3.org/2008/site/images/logo-w3c-mobile-lg
URL: https://www.w3.org/
Goscraper已獲得MIT許可證的許可。