opengraph

package module
v0.0.0-...-a144ce5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2019 License: MIT Imports: 3 Imported by: 0

README

go-opengraph

OpenGraph Protocol fetcher for Golang

Build Status GoDoc

Installation

$ go get github.com/masa0221/go-opengraph

Usage

package main

import (
	"fmt"
	"github.com/masa0221/go-opengraph"
)

func main() {
	og, err := opengraph.Fetch("http://ogp.me")
	if (err != nil) {
		fmt.Println(err)
	}

	fmt.Println(og)
}

Documentation

Overview

Package opengraph provide feature that to fetch website information defined by Open Graph protcol from specified url The Open Graph protocol https://ogp.me/

Example (Fetch)

ExampleFetch demonstrates fetch website information defined by OpenGraph protocol from specified url.

og, err := opengraph.Fetch("http://ogp.me")
if err != nil {
	fmt.Println(err)
}

fmt.Printf("url: %s\n", og["url"])
fmt.Printf("title: %s\n", og["title"])
Output:

url: http://ogp.me/
title: Open Graph protocol

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(url string) (map[string]interface{}, error)

Fetch the website information specified by OpenGraph protcol

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL