https://github.com/null-none/gomdbapi
🍿 Omdb API in Golang
https://github.com/null-none/gomdbapi
api go golang movie movies-api
Last synced: 11 months ago
JSON representation
🍿 Omdb API in Golang
- Host: GitHub
- URL: https://github.com/null-none/gomdbapi
- Owner: null-none
- License: apache-2.0
- Created: 2021-12-10T21:43:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-10T21:53:11.000Z (over 4 years ago)
- Last Synced: 2025-03-21T13:55:10.369Z (about 1 year ago)
- Topics: api, go, golang, movie, movies-api
- Language: Go
- Homepage: http://www.omdbapi.com/
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Omdb API in Golang
=======
***
Usage
-------------
The API usage is very simple.
```go
package main
import (
"fmt"
"github.com/null-none/gomdbapi"
)
func main() {
api := gomdb.Init(YOUR_API_KEY)
query := &gomdb.QueryData{Title: "Macbeth", SearchType: gomdb.MovieSearch}
res, err := api.Search(query)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res.Search)
query = &gomdb.QueryData{Title: "Macbeth", Year: "2015"}
res2, err := api.MovieByTitle(query)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res2)
query = &gomdb.QueryData{Title: "Rick and Morty", Season: "1", Episode: "8", SearchType: gomdb.EpisodeSearch}
res3, err := api.MovieByTitle(query)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res3)
}
```