Try 30 days of free premium.

One request - all data by IMDb ID

binoni wrote 4 years ago: 1

Hello.

It`s possible? imdb + embed

http://api.tvmaze.com/lookup/shows?imdb=tt0944947&embed[]=episodes&embed[]=cast&embed[]=crew&embed[]=akas&embed[]=seasons

this request redirect to /shows/82 and all query params clear.


gazza911 wrote 4 years ago: 1

It's intentional that it doesn't do this.

It's so that you reference the tvmaze ID in further requests rather than always using the lookup.

binoni wrote 4 years ago: 1

I have only IMDb ID, no more data.
I will have to use 2 requests, this affects performance and query limit by two.

const axios = require('axios');

(async function() {

try {

const redirect = await axios.get('http://api.tvmaze.com/lookup/shows?imdb=tt0944947', {maxRedirects: 0, validateStatus: null});

const data = await axios.get(redirect.headers.location + '?embed[]=seasons&embed[]=episodes&embed[]=cast&embed[]=crew&embed[]=akas');

console.log(data);

} catch (error) {

console.error(error);

}

})();

binoni wrote 4 years ago: 1

gazza911 wrote:
It's intentional that it doesn't do this.

It's so that you reference the tvmaze ID in further requests rather than always using the lookup.

This will be counted as 2 requests?


gazza911 wrote 4 years ago: 1

binoni wrote:
This will be counted as 2 requests?

Yes, it would be 2 requests.

What you should be doing is using the lookup to retrieve the TVmaze ID and then storing that information (e.g. in a database) for future requests.

binoni wrote 4 years ago: 1

Thx, @gazza911.

Try 30 days of free premium.