lufinkey / node-justwatch-api

Unofficial JustWatch API for nodejs
71 stars 14 forks source link

Nothing returning when calling Just watch API domain: apis.justwatch.com #6

Open nathanfrindt opened 5 years ago

nathanfrindt commented 5 years ago

The just watch api domain: apis.justwatch.com does not seem to be returning any information.

lufinkey commented 5 years ago

Could you give some examples of what you're calling and what it's returning?

nathanfrindt commented 5 years ago

I have attached screen shots which show the domain not returning a response using postman to see the contents an api. The error I receive when testing my application and calling the information, errors out with a warning at my call to the API. I have also pasted my code as a reference for how I am calling providers and titles.

const Alexa = require('ask-sdk-core');

const GetRemoteDataHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'LaunchRequest' || (handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.intent.name === 'GetRemoteDataIntent'); }, async handle(handlerInput) { let outputSpeech = 'Welcome to where to watch, ask me a tv show or a movie title and I will tell you which streaming services it is available on';

await getRemoteData('apis.justwatch.com')
  .then((response) => {
    const data = JSON.parse(response);
    outputSpeech = `The title ${data.title_id} is available on ${data.providers}. `;
    for (let i = 0; i < data.providers; i++) {
      if (i === 0) {
        //first record
        outputSpeech = outputSpeech + 'The title is available on' + data.providers[i] + ', '
      } else if (i === data.providers - 1) {
        //last record
        outputSpeech = outputSpeech + 'and ' + data.providers[i] + '.'
      } else {
        //middle record(s)
        outputSpeech = outputSpeech + data.providers[i] + ', '
      }
    }
  })
  .catch((err) => {
    //set an optional error message here
    //outputSpeech = err.message;
  });

return handlerInput.responseBuilder
  .speak(outputSpeech)
  .getResponse();

}, };

On Apr 12, 2019, at 10:33 AM, Luis Finke notifications@github.com wrote:

Could you give some examples of what you're calling and what it's returning?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lufinkey/node-justwatch-api/issues/6#issuecomment-482597128, or mute the thread https://github.com/notifications/unsubscribe-auth/AvQ39QcMo3PF9HxqvSsn-8SLf9j_rwrrks5vgJktgaJpZM4csQmc.

lufinkey commented 5 years ago

Sorry to be like this but could you format your code with the markdown backticks so it's readable?

lufinkey commented 5 years ago

Are you using this module? It doesn't look like it's being used anywhere in your code

nathanfrindt commented 5 years ago

Yeah of course I can write it in markdown format so you can read/understand the code. I will send you my code and the corresponding markdown file with it once I finish editing it.

Thanks

Note: I am new to coding Alexa skills and am using an api template to call the just watch api. So feel free to let me know which references are incorrect/ using incorrect format with node.js.

On Apr 12, 2019, at 3:35 PM, Luis Finke notifications@github.com wrote:

Are you using this module? It doesn't look like it's being used anywhere in your code

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lufinkey/node-justwatch-api/issues/6#issuecomment-482696919, or mute the thread https://github.com/notifications/unsubscribe-auth/AvQ39WXU15DSm-CXN_Ec-0yWyBdZIAn8ks5vgN_ugaJpZM4csQmc.

lufinkey commented 5 years ago

You don't need to send me a markdown file. Just edit your comment and wrap the code with triple backticks

On Fri, Apr 12, 2019, 4:51 PM nathanfrindt notifications@github.com wrote:

Yeah of course I can write it in markdown format so you can read/understand the code. I will send you my code and the corresponding markdown file with it once I finish editing it.

Thanks

Note: I am new to coding Alexa skills and am using an api template to call the just watch api. So feel free to let me know which references are incorrect/ using incorrect format with node.js.

On Apr 12, 2019, at 3:35 PM, Luis Finke notifications@github.com wrote:

Are you using this module? It doesn't look like it's being used anywhere in your code

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/lufinkey/node-justwatch-api/issues/6#issuecomment-482696919>, or mute the thread < https://github.com/notifications/unsubscribe-auth/AvQ39WXU15DSm-CXN_Ec-0yWyBdZIAn8ks5vgN_ugaJpZM4csQmc .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lufinkey/node-justwatch-api/issues/6#issuecomment-482718649, or mute the thread https://github.com/notifications/unsubscribe-auth/AHdTURh23aNZl4d-2rB3OKkvb1iI9UI3ks5vgPG9gaJpZM4csQmc .

lufinkey commented 5 years ago

It doesn't look like you're actually using my module at all, though?

nathanfrindt commented 5 years ago

I am referencing the api in this line : await getRemoteData('apis.justwatch.com http://apis.justwatch.com/’).

can you give me an example of what you mean when you say “to edit my comment and wrap it with triple backticks” I know how to edit/add comments but don’t understand what triple backticks are.

On Apr 12, 2019, at 4:53 PM, Luis Finke notifications@github.com wrote:

It doesn't look like you're actually using my module at all, though?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lufinkey/node-justwatch-api/issues/6#issuecomment-482719502, or mute the thread https://github.com/notifications/unsubscribe-auth/AvQ39YI5GUAno3Gsg2fqb7s5Nqwo9ODtks5vgPJdgaJpZM4csQmc.

lufinkey commented 5 years ago

You're referencing the website. Not this module. I don't control the website.

lufinkey commented 5 years ago

It may be that you're not using "https" in the url. Have you tried that?

nathanfrindt commented 5 years ago

Ok I’ll try using https and if that doesn’t work I’ll try calling your module instead. I was using that domain from what was listed in the index.js you had.

On Apr 12, 2019, at 5:10 PM, Luis Finke notifications@github.com wrote:

It may be that you're not using https. Have you tried that?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

nathanfrindt commented 5 years ago

Hi Luis,

I modified my code to include your module before making references to the attributes I am calling to pull the provider and title information. However I am still unable to retrieve information. Please my attached index.js to see where I am calling the providers/titles for my application. Let me know if you have any idea why I am still unable to pull in information.

Thanks,

Nathan

On Apr 17, 2019, at 3:33 PM, Luis Finke notifications@github.com wrote:

Closed #6 https://github.com/lufinkey/node-justwatch-api/issues/6.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lufinkey/node-justwatch-api/issues/6#event-2283774466, or mute the thread https://github.com/notifications/unsubscribe-auth/AL2DP5KGEF52H3DMWSHEQRTPQ53RZANCNFSM4HFRBGOA.

nathanfrindt commented 5 years ago

Hi Luis instead of using the process of calling the Just watch api I am now calling it from your module. Please see my code below:

const JustWatch = require('justwatch-api');

function speak(name, result) { console.log(name+":"); console.log(JSON.stringify(result, null, 4)); console.log("\n\n\n\n"); }

(async function(){ var justwatch = new JustWatch();

var searchResult = await justwatch.search({query: 'always sunny'});

var title = await justwatch.getTitle(searchResult.items[0].id);

var Provider = await justwatch.getProviders(searchResult); })();

const GetRemoteDataHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'LaunchRequest' || (handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.intent.name === 'GetRemoteDataIntent'); },

async handle(handlerInput) { const response = await httpGet();

console.log(response);

return handlerInput.responseBuilder
        .speak(response.title + "is available on the following providers, " + response.Provider)
        .getResponse();

}, };

I am still unable to return any information from the module. Please let me know if I am doing something incorrect.

Thanks,

Nathan

On Apr 17, 2019, at 3:59 PM, Luis Finke notifications@github.com wrote:

Reopened #6 https://github.com/lufinkey/node-justwatch-api/issues/6.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lufinkey/node-justwatch-api/issues/6#event-2283833164, or mute the thread https://github.com/notifications/unsubscribe-auth/AL2DP5NGB3XI3SHGS3WFJY3PQ56QZANCNFSM4HFRBGOA.

nathanfrindt commented 5 years ago

Here is the error which was returned from my logs: (node:1) UnhandledPromiseRejectionWarning: Error: invalid object id: strconv.ParseUint: parsing "undefined": invalid syntax at IncomingMessage.res.on (/var/task/node_modules/justwatch-api/index.js:73:14) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickDomainCallback (internal/process/next_tick.js:218:9)

On Apr 25, 2019, at 9:20 AM, nathan frindt frindtnathan@yahoo.com wrote:

Hi Luis instead of using the process of calling the Just watch api I am now calling it from your module. Please see my code below:

const JustWatch = require('justwatch-api');

function speak(name, result) { console.log(name+":"); console.log(JSON.stringify(result, null, 4)); console.log("\n\n\n\n"); }

(async function(){ var justwatch = new JustWatch();

var searchResult = await justwatch.search({query: 'always sunny'});

var title = await justwatch.getTitle(searchResult.items[0].id);

var Provider = await justwatch.getProviders(searchResult); })();

const GetRemoteDataHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'LaunchRequest' || (handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.intent.name === 'GetRemoteDataIntent'); },

async handle(handlerInput) { const response = await httpGet();

console.log(response);

return handlerInput.responseBuilder
        .speak(response.title + "is available on the following providers, " + response.Provider)
        .getResponse();

}, };

I am still unable to return any information from the module. Please let me know if I am doing something incorrect.

Thanks,

Nathan

On Apr 17, 2019, at 3:59 PM, Luis Finke <notifications@github.com mailto:notifications@github.com> wrote:

Reopened #6 https://github.com/lufinkey/node-justwatch-api/issues/6.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lufinkey/node-justwatch-api/issues/6#event-2283833164, or mute the thread https://github.com/notifications/unsubscribe-auth/AL2DP5NGB3XI3SHGS3WFJY3PQ56QZANCNFSM4HFRBGOA.