README
¶
Links checker
Takes title and og:image from any page:
c := dyatl.Client()
result, err := c.Preview("https://meduza.io/shapito/2020/12/29/kazhduyu-zimu-v-rossii-edyat-zamerzshiy-doshirak-ved-chem-esche-zanyatsya-v-yakutske-ili-novosibirske")
if err != nil {
panic(err)
}
fmt.Println("Title:", c.Title)
fmt.Println("ThumbnailUrl:", c.ThumbnailUrl)
Special cases like YouTube:
c := dyatl.Client()
result, err := c.Preview("https://www.youtube.com/watch?v=eLAHSRmFFzE")
if err != nil {
panic(err)
}
fmt.Println("Title:", c.Title)
fmt.Println("ThumbnailUrl:", c.ThumbnailUrl)
fmt.Println("YoutubeId:", c.YoutubeId)
Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NotHttpUrl = errors.New("not http url") PreviewNotFound = errors.New("preview not found") )
View Source
var ( BadRequest = errors.New("Bad Request") )
View Source
var DefaultDNS = "8.8.8.8:53"
Functions ¶
func YoutubeIdFromUrl ¶
Types ¶
type CheckedURL ¶
func NewCheckedURL ¶
func NewCheckedURL(s string) *CheckedURL
func (CheckedURL) HostAvailable ¶
func (u CheckedURL) HostAvailable() bool
func (CheckedURL) LooksCorrect ¶
func (u CheckedURL) LooksCorrect() bool
type Client ¶
func (Client) GetYoutubeData ¶
func (c Client) GetYoutubeData(id string) (YoutubeData, error)
type YoutubeData ¶
type YoutubeData struct { Type string `json:"type"` Version string `json:"version"` Title string `json:"title"` AuthorName string `json:"author_name"` AuthorUrl string `json:"author_url"` Html string `json:"html"` Width int `json:"width"` Height int `json:"height"` ProviderName string `json:"provider_name"` ProviderUrl string `json:"provider_url"` ThumbnailUrl string `json:"thumbnail_url"` ThumbnailHeight int `json:"thumbnail_height"` ThumbnailWidth int `json:"thumbnail_width"` }
Click to show internal directories.
Click to hide internal directories.