gomdb/README.md

80 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2014-09-21 21:58:21 +00:00
The Golang Omdb API
2014-09-21 17:50:38 +00:00
=======
[![Build Status](https://travis-ci.org/eefret/gomdb.svg?branch=master)](https://travis-ci.org/eefret/gomdb)
[![GoDoc](https://godoc.org/github.com/eefret/go-imdb?status.svg)](https://godoc.org/github.com/eefret/go-imdb)
2014-09-21 17:50:38 +00:00
2014-09-21 18:16:13 +00:00
Author: Christopher T. Herrera (eefretsoul AT gmail DOT com)
2014-09-21 18:19:16 +00:00
<iframe src="http://githubbadge.appspot.com/eefret" style="border: 0;height: 142px;width: 200px;overflow: hidden;" frameBorder="0"></iframe>
2014-09-21 18:16:13 +00:00
This API uses the [omdbapi.com](http://omdbapi.com/) API by Brian Fritz
***
### OMDBAPI.com
This is an excellent open database for movie and film content.
I *strongly* encourage you to check it out and contribute to keep it growing.
### http://www.omdbapi.com
***
Project Usage
-------------
2016-06-15 07:07:45 +00:00
The API usage is very simple.
```go
package main
import (
"fmt"
2016-06-20 14:40:17 +00:00
"github.com/eefret/gomdb"
2016-06-15 07:07:45 +00:00
)
func main() {
2019-03-19 09:52:20 +00:00
api := gomdb.Init(YOUR_API_KEY)
2016-06-15 07:07:45 +00:00
query := &gomdb.QueryData{Title: "Macbeth", SearchType: gomdb.MovieSearch}
2017-05-24 12:33:12 +00:00
res, err := api.Search(query)
2016-06-15 07:07:45 +00:00
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res.Search)
query = &gomdb.QueryData{Title: "Macbeth", Year: "2015"}
2017-05-24 12:33:12 +00:00
res2, err := api.MovieByTitle(query)
2016-06-15 07:07:45 +00:00
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res2)
2019-03-19 09:52:20 +00:00
query = &gomdb.QueryData{Title: "Rick and Morty", Season: "1", Episode: "8", SearchType: gomdb.EpisodeSearch}
res3, err := api.MovieByTitle(query)
2016-06-15 07:07:45 +00:00
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res3)
}
2019-03-19 09:52:20 +00:00
query = &gomdb.QueryData{ImdbId: "tt2884018"}
res4, err := api.MovieByImdbID(query)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res4)
query = &gomdb.QueryData{ImdbId: "tt0944947", Season: "1", Episode: "1", SearchType: gomdb.EpisodeSearch}
res5, err := api.MovieByImdbID(query)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res5)
2016-06-15 07:07:45 +00:00
```
2014-09-21 21:55:27 +00:00
2014-09-21 18:16:13 +00:00
See the project documentation to see the Response Objects and stuff