trakt / api-help

Trakt API docs at https://trakt.docs.apiary.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Runtime in history request

xP9nda opened this issue · comments

commented

Hello there,
I am currently writing a program which generates yearly statistics for my entire watch history.

I am making use of the request https://api.trakt.tv/xp9nda/history?page=(number)&limit=100 to get my watch history, which is then locally cached. I need the runtime of episodes and movies for my program to work as intended, and using the above request gets the following results: (results taken from my most recently watched item as of writing this)

{'action': 'checkin',
 'episode': {'ids': {'imdb': 'tt15310802',
                     'tmdb': 4177840,     
                     'trakt': 7265463,    
                     'tvdb': 9420973,
                     'tvrage': None},
             'number': 8,
             'season': 1,
             'title': 'Not the Eternal'},
 'id': 8896774197,
 'show': {'ids': {'imdb': 'tt13802576',
                  'slug': 'lockwood-co',
                  'tmdb': 213241,
                  'trakt': 199293,
                  'tvdb': 422028,
                  'tvrage': None},
          'title': 'Lockwood & Co.',
          'year': 2023},
 'type': 'episode',
 'watched_at': '2023-03-20T12:04:41.000Z'}

and as you can see, no runtime.

I am currently retrieving the runtime of each item by sending a separate request using one of the following two:
for episodes: /shows/(slug)/seasons/(season)/episodes/(episode)?extended=full
for movies: /movies/(slug)?extended=full

This results in a lot of API calls, my entire history is around 7000 items and to send an additional 7000 separate requests just to get the runtime of each item seems a little ridiculous.

I was wondering if there is any way to retrieve the runtime of items through the /history request, or if it would be possible to get it added if there currently isn't a way?

Thanks for reading and I look forward to a reply.

commented

Just add ?extended=full to the /history method.