TvdbPartyV2
Simple Ruby library to talk to thetvdb.com API v4. Migrated from the deprecated v2 API (the gem name is kept for continuity). Requires Ruby >= 3.0; tested on Ruby 3.4 and 4.0.
what is thetvdb.com?
This site is an open tvshow database that can be modified by anybody. thetvdb.com api v4 (https://api4.thetvdb.com/v4, docs: https://thetvdb.github.io/v4-api/)
The legacy v2 API (api.thetvdb.com) has been decommissioned. v4 requires an API key; personal keys also require an active TheTVDB subscription PIN.
Installation
Add this line to your application's Gemfile:
gem 'tvdb_party_v2'And then execute:
$ bundle
Or install it yourself as:
$ gem install tvdb_party_v2
Usage
# connect api — v4 auth: apikey + optional pin (subscriber keys only)
@thetvdb = TvdbPartyV2::Search.new(apikey)
@thetvdb = TvdbPartyV2::Search.new(apikey, pin, 'en')
# search tv show
r = @thetvdb.search("Homeland")
# get series
puts homeland = @thetvdb.get_series_by_id(r.first["id"])
# get episode
puts s01e01 = homeland.episode(1,1)
# get series fanart (banner URLs are built as https://www.thetvdb.com/banners/ + the artwork path)
homeland.fanart.first.url
# get series posters
homeland.posters.first.url
# get series banners
homeland.series_banners.first.url
# get season posters (filtered by season number)
homeland.season_posters(2).first.url
# v4 new: movies (v4-only entity)
movies = @thetvdb.movies
movie = @thetvdb.get_movie_by_id(12345)
# v4 new: season detail with episodes
season = @thetvdb.get_season_by_id(46249)Development
After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/davidpan/tvdb_party_v2. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the TvdbPartyV2 project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
Thanks
Project Derived from maddox/tvdb_party.
Thanks to thetvdb.com for their awesome database allowing us to meta out to our heart's content. Project name graciously stolen from jduff/tmdb_party.