All Projects → cyruzin → Golang Tmdb

cyruzin / Golang Tmdb

Licence: mit
This is a Golang wrapper for working with TMDb API. It aims to support version 3.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Golang Tmdb

HerePy
A library that provides a Python interface to the HERE APIs.
Stars: ✭ 73 (+102.78%)
Mutual labels:  wrapper, api-wrapper
popyt
A very easy to use Youtube Data v3 API wrapper.
Stars: ✭ 42 (+16.67%)
Mutual labels:  wrapper, api-wrapper
discord.bat
🗑️ the BEST discord lib
Stars: ✭ 38 (+5.56%)
Mutual labels:  wrapper, api-wrapper
nanoleaf-aurora
A java wrapper for the Nanoleaf Aurora API
Stars: ✭ 19 (-47.22%)
Mutual labels:  wrapper, api-wrapper
Scrython
A python wrapper for the Scryfall API
Stars: ✭ 87 (+141.67%)
Mutual labels:  wrapper, api-wrapper
activecampaign-python
ActiveCampaign API wrapper written in python.
Stars: ✭ 25 (-30.56%)
Mutual labels:  wrapper, api-wrapper
cablecuttr
An R wrapper for CanIStream.It API
Stars: ✭ 17 (-52.78%)
Mutual labels:  wrapper, api-wrapper
Discord.jl
The Julia Discord API Wrapper
Stars: ✭ 93 (+158.33%)
Mutual labels:  wrapper, api-wrapper
SoundCloud-API
SoundCloud API wrapped into a bunch of classes. Built with Retrofit2 and RxJava2.
Stars: ✭ 63 (+75%)
Mutual labels:  wrapper, api-wrapper
Dis-Snek
A Python API wrapper for Discord
Stars: ✭ 71 (+97.22%)
Mutual labels:  wrapper, api-wrapper
PowerSchool-API
A Node.js library for interacting with the PowerSchool SIS API.
Stars: ✭ 21 (-41.67%)
Mutual labels:  wrapper, api-wrapper
Cuda Api Wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
Stars: ✭ 362 (+905.56%)
Mutual labels:  wrapper, api-wrapper
Tlaw
The Last API Wrapper: Pragmatic API wrapper framework
Stars: ✭ 112 (+211.11%)
Mutual labels:  wrapper, api-wrapper
tmdbv3api
A lightweight Python library for The Movie Database (TMDb) API. The TMDb API is a resource for developers to integrate movie, TV show and cast data along with posters or movie fan art.
Stars: ✭ 145 (+302.78%)
Mutual labels:  tmdb, api-wrapper
Binancedotnet
Official C# Wrapper for the Binance exchange API, with REST and WebSocket endpoints
Stars: ✭ 102 (+183.33%)
Mutual labels:  wrapper, api-wrapper
Pyblox
An API wrapper for Roblox written in Python. (Receives Updates)
Stars: ✭ 30 (-16.67%)
Mutual labels:  wrapper, api-wrapper
oxford dictionary
📙 A Ruby wrapper for the Oxford Dictionary API
Stars: ✭ 23 (-36.11%)
Mutual labels:  wrapper, api-wrapper
Pycoingecko
Python wrapper for the CoinGecko API
Stars: ✭ 270 (+650%)
Mutual labels:  wrapper, api-wrapper
Python Poloniex
Poloniex API wrapper for Python 2.7 & 3
Stars: ✭ 557 (+1447.22%)
Mutual labels:  wrapper, api-wrapper
Fbbotw
Python Wrapper for Facebook Messenger Bot Platform.
Stars: ✭ 15 (-58.33%)
Mutual labels:  wrapper

Build Status Build status Coverage Status Go Report Card GoDoc GitHub tag (latest SemVer) GitHub license

This is a Golang wrapper for working with TMDb API. It aims to support version 3.

An API Key is required. To register for one, head over to themoviedb.org.

This product uses the TMDb API but is not endorsed or certified by TMDb.

Requirements

  • Go 1.13.x or higher. We aim to support the latest supported versions of go.

Installation

go get -u github.com/cyruzin/golang-tmdb

Usage

To get started, import the tmdb package and initiate the client:

import "github.com/cyruzin/golang-tmdb"

tmdbClient, err := tmdb.Init(os.GetEnv("YOUR_APIKEY"))
if err != nil {
    fmt.Println(err)
}

// OPTIONAL: Setting a custom config for the http.Client.
// The default timeout is 10 seconds. Here you can set other
// options like Timeout and Transport.
customClient := http.Client{
    Timeout: time.Second * 5,
    Transport: &http.Transport{
        MaxIdleConns: 10,
        IdleConnTimeout: 15 * time.Second,
    }
}

tmdbClient.SetClientConfig(customClient)

// OPTIONAL: Enable this option if you're going to use endpoints
// that needs session id.
//
// You can read more about how this works:
// https://developers.themoviedb.org/3/authentication/how-do-i-generate-a-session-id
tmdbClient.SetSessionID(os.GetEnv("YOUR_SESSION_ID"))

// OPTIONAL (Recommended): Enabling auto retry functionality.
// This option will retry if the previous request fail.
tmdbClient.SetClientAutoRetry()

movie, err := tmdbClient.GetMovieDetails(297802, nil)
if err != nil {
 fmt.Println(err)
}

fmt.Println(movie.Title)

With optional params:

import "github.com/cyruzin/golang-tmdb"

tmdbClient, err := tmdb.Init(os.GetEnv("YOUR_APIKEY"))
if err != nil {
    fmt.Println(err)
}

options := map[string]string{
  "language": "pt-BR",
  "append_to_response": "credits,images",
}

movie, err := tmdbClient.GetMovieDetails(297802, options)
if err != nil {
 fmt.Println(err)
}

fmt.Println(movie.Title)

Helpers:

Generate image and video URLs:

import "github.com/cyruzin/golang-tmdb"

tmdbClient, err := tmdb.Init(os.GetEnv("YOUR_APIKEY"))
if err != nil {
    fmt.Println(err)
}

options := map[string]string{
 "append_to_response": "videos",
}

movie, err := tmdbClient.GetMovieDetails(297802, options)
if err != nil {
 fmt.Println(err)
}

fmt.Println(tmdb.GetImageURL(movie.BackdropPath, tmdb.W500))
// Output: https://image.tmdb.org/t/p/w500/bOGkgRGdhrBYJSLpXaxhXVstddV.jpg
fmt.Println(tmdb.GetImageURL(movie.PosterPath, tmdb.Original))
// Ouput: https://image.tmdb.org/t/p/original/bOGkgRGdhrBYJSLpXaxhXVstddV.jpg

for _, video := range movie.MovieVideosAppend.Videos.MovieVideos.Results {
   if video.Key != "" {
	 fmt.Println(tmdb.GetVideoURL(video.Key))
     // Output: https://www.youtube.com/watch?v=6ZfuNTqbHE8
   }
}

For more examples, click here.

Performance

Getting Movie Details:

Iterations ns/op B/op allocs/op
19 60886648 60632 184

Multi Search:

Iterations ns/op B/op allocs/op
16 66596963 107109 608

Contributing

To start contributing, please check CONTRIBUTING.

Tests

For local testing, create a environment variable called "APIKey" and enter your TMDb key. Check the "tmdb_test.go" file for more details.

License

MIT

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].