ynhhoJ / flibusta-api

Unofficial Flibusta API based on website search engine.
MIT License
16 stars 2 forks source link

TypeError: FlibustaAPI is not a constructor #42

Closed toropanov closed 1 year ago

toropanov commented 1 year ago

My script is quite simple one. But I cannot execute it.

search.js file:

import FlibustaAPI from 'flibusta';

(async () => {
  const flibustaApi = new FlibustaAPI();

  const searchAuthorsResult = await flibustaApi.getAuthors('Шерлок');

  console.log(JSON.stringify(searchAuthorsResult, undefined, 2));
})();

I always get an error TypeError: FlibustaAPI is not a constructor. I use command node search.js to launch.

ynhhoJ commented 1 year ago

Can you try to import / use through .default?

Example:

const { default: FlibustaAPI } = require('flibusta');