Closed summerset-zz closed 2 years ago
I think this is a problem due to an older version. I have just released cejs 4.5.2, please try the new version and report back if it works, thanks.
I think this is a problem due to an older version. I have just released cejs 4.5.2, please try the new version and report back if it works, thanks.
Still not working:
D:\git repo\warframe-items-for-huiji\node_modules\cejs\application\net\wiki.js:198
&& API_URL.includes('://')) {
^
TypeError: API_URL.includes is not a function
at new wiki_API (D:\git repo\warframe-items-for-huiji\node_modules\cejs\application\net\wiki.js:198:14)
at Wikiapi (D:\git repo\warframe-items-for-huiji\node_modules\wikiapi\Wikiapi.js:92:23)
at Object.<anonymous> (D:\git repo\warframe-items-for-huiji\scripts\parseTemplateData.js:5:5)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
package-lock.json:
"cejs": {
"version": "4.5.2",
"resolved": "https://registry.npmmirror.com/cejs/-/cejs-4.5.2.tgz",
"integrity": "sha512-GfDi1OVIkkYEOPEEBEcwkKVQ2vxSSxsbT7B7VrvNp7QRMiccGgaQtT/OkiK0yB06sZhFvr9tDVRc5n2JQwmawQ=="
}
I am a bit curious because new Wikiapi('https://warframe.huijiwiki.com/api.php')
is passing in a string, and wiki_API should also only receive the string. I tried it on my machine and I can get [[吞天沙暴]] properly. Maybe you can provide some code for parseTemplateData.js for me to try?
--solved--
Well I tried another method and it worked.
I removed the 'async domain', and instead wrapped it in an async function, and run it after definition and it worked(at least the server responsed)
the code as below:
const WikiApi = require('wikiapi')
async function main() {
const wiki = new WikiApi('https://sands-of-salzaar.fandom.com/api.php')
let pageData = await wiki.page('Classes', {})
debugger
}
main()
so I'm just curious why (async()=>{/*codes here*/})()
not working.
anyway thanks alot~
@summerset-zz I am very interested in your report.
In fact I myself use (async()=>{/*codes here*/})()
https://github.com/kanasimi/wikibot/blob/master/routine/20211203.synchronizing_common_pages.js#L57
And I have no problem running with your example.
If you don't mind, can you provide the code to reproduce the problem independently?
Thank you.
Hey: I'm trying to build a little template-to-csv tool with wikiapi. the problem in the title occurs when the script runs
new Wikiapi("https://warframe.huijiwiki.com/api.php")
the environment I use as below:
the full code I ran as below:
the error in the console:
I tried a little debug on the module and located the problem:
/cejs/application/net/wiki.js
line 194, right beforeAPI_URL.includes('://')
and found API_URL is an async function instead of string.yet I'm too noob to fix it, I need advice, thank you~