Note: I'm normally coding in Python, so I am completely new to javascript.
I'm trying to use the following repo: https://github.com/omerdn1/otter.ai-api
I used the setup code, but I replaced the import with the following instead: const OtterApi = require('otter.ai-api')
because I was getting SyntaxError: Cannot use import statement outside a module
.
However, now I'm getting the following error: TypeError: OtterApi is not a constructor
. If I look at index.js in the repo, it does look like a constructor? First part of the code is:
class OtterApi {
constructor(options = {}) {
this.options = options;
this.user = {};
this.csrfToken = '';
}
init = async () => {
await this.#login();
};
The code I'm trying to run:
const OtterApi = require('otter.ai-api');
const otterApi = new OtterApi({
email: 'email', // Your otter.ai email
password: 'pw', // Your otter.ai password
});
async function main() {
await otterApi.init() // Performs login
}
main();
I get the error when using new OtterApi()
. I'm not sure how to resolve this.
CodePudding user response:
You need to refer to the "default" export:
const OtterApi = require('otter.ai-api').default;