Saurabh3333 / give-me-a-joke

A npm-module for random and customized jokes.
https://www.npmjs.com/package/give-me-a-joke
MIT License
14 stars 10 forks source link

Unable to fetch jokes #20

Closed Abhisin90 closed 1 year ago

Abhisin90 commented 1 year ago

Inside index.js i have written this code

const jokes = require('give-me-a-joke') console.dir(jokes) jokes.getRandomDadJoke((joke) => { console.log(joke) })

On running it

I am getting this output

index js - node - Visual Studio Code 30-10-2022 13_15_01 (3)

Similarly on running

const jokes = require('give-me-a-joke') console.dir(jokes) jokes.getRandomCNJoke((joke) => { console.log(joke) })

my output comes this

index js - node - Visual Studio Code 30-10-2022 13_18_30

Is there any problem from my end or yours. Kindly help. Thanks for the help in advance

user2695 commented 1 year ago

Hello @Abhisin90 The issue is not with the npm package but with the site it gets jokes from. You can verify it by having a look at the source code. As of Nov 4 2022, the site is down.

var giveMeAJoke = require("give-me-a-joke");

giveMeAJoke.getRandomDadJoke(function (joke) {
  console.log(joke);
});

The above code will work fine because it gets jokes from some other site

walidChaybi commented 1 year ago

it's just of the website is down not because of the pckage, if you try with Dadjokes it works fine, but with CNjokes it doesn't work

Saurabh3333 commented 1 year ago

Do you guys want to contribute to make this package better? :-)

Villian79 commented 1 year ago

Hello @Saurabh3333. To fix getRandomCNJoke may I suggest using this API ? The old API resource is not available anymore. If it's ok, I will submit a pull request

Saurabh3333 commented 1 year ago

Go ahead.

Thank you, Regards Saurabh Shubham +91-9973286609 @.***

On Mon, 13 Mar, 2023, 3:21 am Igor Vilinchuk, @.***> wrote:

Hello @Saurabh3333 https://github.com/Saurabh3333. To fix getRandomCNJoke may I suggest using this API https://api.chucknorris.io/? The old API resource http://api.icndb.com/ is not available anymore. If it's ok, I will submit a pull request

— Reply to this email directly, view it on GitHub https://github.com/Saurabh3333/give-me-a-joke/issues/20#issuecomment-1465309032, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEY6OVP4TBYDZZN7FLFJF6LW3ZAO5ANCNFSM6AAAAAARSFGBDQ . You are receiving this because you were mentioned.Message ID: @.***>