Wikipedia icon indicating copy to clipboard operation
Wikipedia copied to clipboard

Search Not working

Open reactsaas opened this issue 3 months ago • 3 comments

had to apply this patch

 diff --git a/node_modules/wikipedia/dist/request.js b/node_modules/wikipedia/dist/request.js
index 7076dc2..1216b80 100644
--- a/node_modules/wikipedia/dist/request.js
+++ b/node_modules/wikipedia/dist/request.js
@@ -11,6 +11,7 @@ USER_AGENT = 'wikipedia (https://github.com/dopecodez/Wikipedia/)';
 async function callAPI(url) {
     const options = {
         headers: {
+            "User-Agent": USER_AGENT,
             "Api-User-Agent": USER_AGENT,
         },
     };

reactsaas avatar Nov 05 '25 12:11 reactsaas

which version are you using? can you share the issue you are recieving?

dopecodez avatar Nov 05 '25 13:11 dopecodez

i dont have the error message anymore sorry .. but basically it happened on latest version and every other version .. when using .search .. when i looked through the code i think i noticed that the search didnt use the legacy api or something along those lines

reactsaas avatar Nov 06 '25 12:11 reactsaas

I encounter the same issue whenever trying to call wikipedia.summary(). The error looks like this:

1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | exports.citationError = exports.pdfError = exports.fcError = exports.eventsError = exports.mediaError = exports.relatedError = exports.introError = exports.preloadError = exports.infoboxError = exports.coordinatesError = exports.geoSearchError = exports.linksError = exports.categoriesError = exports.contentError = exports.htmlError = exports.imageError = exports.summaryError = exports.pageError = exports.autocompletionsError = exports.searchError = exports.wikiError = void 0;
4 | class wikiError extends Error {
5 |     constructor(message, code) {
6 |         super(message);
            ^
summaryError: summaryError: wikiError: AxiosError: Request failed with status code 403
 code: undefined,

Applying the patch mentioned above made the issue go away for me.

lucasBent avatar Nov 09 '25 20:11 lucasBent

Same error (AxiosError: Request failed with status code 403). If I apply the proposed fix, it works. Can this be merged and released soon? @dopecodez

Tomas2D avatar Nov 27 '25 15:11 Tomas2D