All Projects → dyatlov → go-oembed

dyatlov / go-oembed

Licence: MIT license
Golang package for parsing Oembed data from known providers by URL

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-oembed

Uap Ruby
A simple, comprehensive Ruby gem for parsing user agent strings with the help of BrowserScope's UA database
Stars: ✭ 188 (+754.55%)
Mutual labels:  parse
Jquery.terminal
jQuery Terminal Emulator - JavaScript library for creating web-based terminals with custom commands
Stars: ✭ 2,623 (+11822.73%)
Mutual labels:  parse
Swiftsoup
SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)
Stars: ✭ 3,079 (+13895.45%)
Mutual labels:  parse
Dd Plist
A java library providing support for ASCII, XML and binary property lists.
Stars: ✭ 201 (+813.64%)
Mutual labels:  parse
Json
A C++11 or library for parsing and serializing JSON to and from a DOM container in memory.
Stars: ✭ 205 (+831.82%)
Mutual labels:  parse
Termsql
Convert text from a file or from stdin into SQL table and query it instantly. Uses sqlite as backend. The idea is to make SQL into a tool on the command line or in scripts.
Stars: ✭ 230 (+945.45%)
Mutual labels:  parse
Magnet Uri
Parse a magnet URI and return an object of keys/values
Stars: ✭ 183 (+731.82%)
Mutual labels:  parse
berkeley-parser-analyser
A tool for classifying mistakes in the output of parsers
Stars: ✭ 34 (+54.55%)
Mutual labels:  parse
Parse
Go parsers for web formats
Stars: ✭ 224 (+918.18%)
Mutual labels:  parse
Tmxlite
lightweight C++14 parser for Tiled tmx files
Stars: ✭ 248 (+1027.27%)
Mutual labels:  parse
Forensic Tools
A collection of tools for forensic analysis
Stars: ✭ 204 (+827.27%)
Mutual labels:  parse
Tsql Parser
Library Written in C# For Parsing SQL Server T-SQL Scripts in .Net
Stars: ✭ 203 (+822.73%)
Mutual labels:  parse
Skrape.it
A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML (server & client-side rendered). It places particular emphasis on ease of use and a high level of readability by providing an intuitive DSL. It aims to be a testing lib, but can also be used to scrape websites in a convenient fashion.
Stars: ✭ 231 (+950%)
Mutual labels:  parse
Picasso
一款sketch生成代码插件,可将sketch设计稿自动解析成前端代码。
Stars: ✭ 191 (+768.18%)
Mutual labels:  parse
opensource
Collection of Open Source packages by Otherwise
Stars: ✭ 21 (-4.55%)
Mutual labels:  parse
Flags
⛳ Simple, extensible, header-only C++17 argument parser released into the public domain.
Stars: ✭ 187 (+750%)
Mutual labels:  parse
Zipson
JSON parse and stringify with compression
Stars: ✭ 229 (+940.91%)
Mutual labels:  parse
sqlite-createtable-parser
A parser for sqlite create table sql statements.
Stars: ✭ 67 (+204.55%)
Mutual labels:  parse
parse-github-url
Parse a Github URL into an object. Supports a wide variety of GitHub URL formats.
Stars: ✭ 114 (+418.18%)
Mutual labels:  parse
Subtitle.js
Stream-based library for parsing and manipulating subtitle files
Stars: ✭ 234 (+963.64%)
Mutual labels:  parse

GO Oembed

GoDoc

Go Oembed provides methods to retrieve oEmbed data from known providers. The provider list can be fetched from this repository or from oembed.com/providers.json

Install

go get github.com/dyatlov/go-oembed/oembed

Example

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
	"strings"

	"github.com/dyatlov/go-oembed/oembed"
)

func main() {
	data, err := ioutil.ReadFile("../providers.json")

	if err != nil {
		panic(err)
	}

	oe := oembed.NewOembed()
	oe.ParseProviders(bytes.NewReader(data))

	for {

		reader := bufio.NewReader(os.Stdin)
		fmt.Print("Enter url: ")
		url, _ := reader.ReadString('\n')

		url = strings.Trim(url, "\r\n")

		if url == "" {
			break
		}

		item := oe.FindItem(url)

		if item != nil {
			info, err := item.FetchOembed(oembed.Options{URL: url})
			if err != nil {
				fmt.Printf("An error occured: %s\n", err.Error())
			} else {
				if info.Status >= 300 {
					fmt.Printf("Response status code is: %d\n", info.Status)
				} else {
					fmt.Printf("Oembed info:\n%s\n", info)
				}
			}
		} else {
			fmt.Println("nothing found :(")
		}

	}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].