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 라이센스에 따라 라이센스가 부여됩니다.