Closed petersandor closed 7 years ago
Hmm... I do not think there was a change in the API. I just tested this code:
import wiki from 'wikijs';
wiki({
apiUrl: 'https://en.wikipedia.org/w/api.php'
}).page('Batman')
.then(page => page.info('alter_ego'))
.then(console.log);
And it printed out Bruce Wayne
as expected.
Let me try to look into the CORS issues though.
Do you have any example code I can test?
And do you have the un-parsable response you spoke about?
After giving it a try, I go the same result as you.
I think we are going to have to use the JSONP method to fix this issue.
https://www.mediawiki.org/wiki/API:Cross-site_requests
This change may not be straightforward...
I would look into trying to use service workers to circumvent the CORS issue for now.
any fix for this?
I commented above how to get around the issue for now. If you must us this module browser based, try using it inside of a service worker. If you are using it within node, there should not be an issue.
I have yet to implement the JSONP feature.
Fixed with #40
Hi, this module is still using HTTP as the base API url, so the default configuration doesn't work on Chrome since it blocks the request. I solved it by providing the
apiUrl
option withhttps
.Another issue I have, I'm getting CORS error when I try to use the module:
I'm using this in the browser (not in service worker), and I haven't found any possibility to pass an option for the
fetch
to circumvent the above issue.I'm new to Wiki APIs, but I think that the API was recently changed, because even when I manage to get the response it can't be parsed.
Any help and/or clarification greatly appreciated, thanks!