kanasimi / wikiapi

JavaScript MediaWiki API for node.js
https://kanasimi.github.io/wikiapi/
BSD 3-Clause "New" or "Revised" License
47 stars 5 forks source link

Example broken on OSX #47

Closed CleanGlyph closed 2 years ago

CleanGlyph commented 2 years ago

Machine:

OSX Big Sur, node.js: 7.22.0

Code:

const Wikiapi = require('wikiapi');

(async()=>{
    const wiki = new Wikiapi('zn');     
    let page_data = await wiki.page('Universe', {});
    console.log('page_data: ', page_data);
    console.log('page_data.text: ', page_data.wikitext)
})()

Output:

/Users/name/Documents/fun dev/wikiScraper/node_modules/cejs/application/net/wiki.js:201
                && API_URL.includes('://')) {
                           ^

TypeError: API_URL.includes is not a function
    at new wiki_API (/Users/name/Documents/fun dev/wikiScraper/node_modules/cejs/application/net/wiki.js:201:14)
    at Wikiapi (/Users/name/Documents/fun dev/wikiScraper/node_modules/Wikiapi/Wikiapi.js:92:23)
    at Object.<anonymous> (/Users/name/Documents/fun dev/wikiScraper/index.js:3:1)

etc:

Only can run the example that pulls the hanzi character from the page every other has this error, or if I try to use English wikipedia or any other input.

(I don't know if this is user error or not)

kanasimi commented 2 years ago

Maybe you means const wiki = new Wikiapi('zh'); instead of 'zn'? However, even I testing 'zn', I can't reproduce this error. Please provide more information.

CleanGlyph commented 2 years ago

My apologies I'm just seeing this now, the English demos also failed I just tried to rewrite the main one that also failed. Code wise, other than this mistake, it's just been copying and pasting verbatim from the examples.

What other information can I provide that would be helpful?

kanasimi commented 2 years ago

Are you meet the same error shown above?

kanasimi commented 2 years ago

Sorry, is this issue solved?

CleanGlyph commented 2 years ago

Yea I deleted node modules, rebooted, reran npm install and then demos worked @kanasimi