-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple.go
More file actions
30 lines (24 loc) · 765 Bytes
/
Copy pathsimple.go
File metadata and controls
30 lines (24 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package main
import (
"fmt"
"log"
"github.com/lalabuy948/webprev"
)
func main() {
webPrev, err := webprev.Preview("https://telegram.org")
if err != nil {
log.Fatal(err)
}
// default / generic ones
fmt.Println("title: ", webPrev.Generic.Title)
fmt.Println("description: ", webPrev.Generic.Description)
fmt.Println("img_url: ", webPrev.Generic.ImgURL)
// OpenGraph aka facebook
fmt.Println("op:title: ", webPrev.OpenGraph.Title)
fmt.Println("op:description: ", webPrev.OpenGraph.Description)
fmt.Println("op:img_url: ", webPrev.OpenGraph.ImgURL)
// twitter card
fmt.Println("twitter:title: ", webPrev.Twitter.Title)
fmt.Println("twitter:description: ", webPrev.Twitter.Description)
fmt.Println("twitter:img_url: ", webPrev.Twitter.ImgURL)
}