dbr / tvdb_api

Simple to use interface to TheTVDB.com API in Python
The Unlicense
339 stars 63 forks source link

Episode ID search #44

Open Nasjoe opened 10 years ago

Nasjoe commented 10 years ago

Hi ! Thanks for you API, it fantastic :) I would know if it's possible to search an episode with his own TV ID ?

Thks ! Slaan.

dbr commented 10 years ago

Glad you find it useful!

Do you mean looking it up by the TVDB ID number? If so, you just pass it as an integer instead of the show name string:

>>> import tvdb_api
>>> t = tvdb_api.Tvdb()
>>> t[76156]
<Show Scrubs (containing 10 seasons)>

Bear in mind you typically get back a string from the API, so you might have to convert it like so:

>>> sid = t['scrubs']['id']
>>> sid
u'76156'
>>> t[int(sid)]
<Show Scrubs (containing 10 seasons)>

Closing - feel free to reopen if I misinterpreted!

Nasjoe commented 10 years ago

Hi ! No, i talk about the episode ID. On the adress of TVDB, we have for exemple : http://thetvdb.com/?tab=episode&seriesid=121361&seasonid=568657&id=4721938&lid=17

The 4721938 is the episode ID (GoT S04E01)

With your api, we can get it with : t[121361][4][1]['id']

It is possible to search directly with this number ? Many thanks !

dbr commented 10 years ago

Ahh, I see what you mean.

Nope, this currently isn't exposed by tvdb_api - currently it only gets data via the /series/ thing, not /episode/, http://thetvdb.com/wiki/index.php/Programmers_API#File_Structure

dbr commented 4 years ago

This is still valid with the new API, there is a /episodes/{id} endpoint