Git Product home page Git Product logo

Comments (16)

dijs avatar dijs commented on September 27, 2024

Let me take a look.

from wiki.

dijs avatar dijs commented on September 27, 2024

Ah ha!

Here is your problem.

{ servedby: 'ap-s140',
  error:
   { code: 'srsearch-text-disabled',
     info: 'text search is disabled' } }

They have text search disabled for their wiki...

from wiki.

dijs avatar dijs commented on September 27, 2024

I fixed the code to handle errors better though.

fb683cf

from wiki.

dijs avatar dijs commented on September 27, 2024

Pushed that change in v4.2.1

from wiki.

 avatar commented on September 27, 2024

My issue seems to be deeper than that, there is an odd difference in Wikia/MediaWiki/Fandom Wikia, the one I'm trying to access seems to have a different but very similar API, or possibly two API's, one being similar and one the same. I don't know your library is supposed to support whatever this is using, if so then this may be an issue.

To see what I mean, look here: http://oldschoolrunescape.wikia.com/api/v1/
I made my own Wikia on the same platform as the oldschoolrunescape wikia to test if its possible to enable the "Text Search" and I can't find any such option.

Excuse me if im mistaken at all, im a bit confused on the difference between the oldschoolrunescape wikia and the game of thrones one you provide, what I do know is that my one isn't self-hosted by the admins, its hosted by "FANDOM" and the game of thrones one is hosted by the admins.

from wiki.

dijs avatar dijs commented on September 27, 2024

I am learning the difference myself :/

Let's try to dig into this.

I am betting that they use the same underlying API base, but their configurations are very different.

Were you able to run any wikijs methods successfully on the runescape version?

from wiki.

 avatar commented on September 27, 2024
const wiki = require('wikijs').default;

var osrswiki = wiki({
    apiUrl: 'http://oldschoolrunescape.wikia.com/api.php',
    origin: null
});

osrswiki.page('Quests').then(page => console.log(page));

/* Successful
{ raw:
   { pageid: 6930,
     ns: 0,
     title: 'Quests',
     touched: '2017-09-13T15:23:51Z',
     lastrevid: 4740981,
     length: 9074,
     fullurl: 'http://oldschoolrunescape.wikia.com/wiki/Quests',
     editurl: 'http://oldschoolrunescape.wikia.com/wiki/Quests?action=edit' },
  html: [Function: html],
  content: [Function: content],
  summary: [Function: summary],
  images: [Function: images],
  references: [Function: references],
  links: [Function: links],
  categories: [Function: categories],
  coordinates: [Function: coordinates],
  info: [Function: q],
  backlinks: [Function: backlinks],
  rawImages: [Function: h],
  mainImage: [Function: mainImage],
  rawInfo: [Function: p] }
  */

osrswiki.page('Quests').then(page => console.log(page.pageid));

/* Fail
undefined
*/

osrswiki.random(3).then(results => console.log(results[0]));

/* Successful
Returns 1 Random Page Name, e.g. "Woad seed"
*/

osrswiki.page('Quests').then(page => page.categories()).then(console.log);

/* Successful
[ 'Category:Free-to-play Quests',
  'Category:Interface',
  'Category:Quests' ]
*/

osrswiki.page('Quests').then(page => page.references()).then(console.log);

/* Fail
(node:7356) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): TypeError: Cannot read property 'map' of undefined
*/

osrswiki.page('Quests').then(page => page.summary()).then(console.log);

/* Fail
undefined
*/

osrswiki.page('Quests').then(page => page.mainImage()).then(console.log);

/* Successful
https://vignette.wikia.nocookie.net/2007scape/images/0/05/Quest_icon.png/revisio
n/latest?cb=20130216162745
*/

osrswiki.page('Quests').then(page => page.image()).then(console.log);

/* Fail
(node:7724) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): TypeError: page.image is not a function
*/


//Trying to request a page that doesnt exist
osrswiki.page('batman').then(console.log);

/* Fail
(node:5492) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): Error: No article found
*/

here are some tests I did

from wiki.

dijs avatar dijs commented on September 27, 2024

This is great work!

At the very least I think I can do better error handling around all of these methods and check if they are supported on each MediaWiki implementation.

from wiki.

dijs avatar dijs commented on September 27, 2024

But since SOME work and SOME don't, it really leads me to believe that this has everything to do with configuration of the wiki API...

from wiki.

 avatar commented on September 27, 2024

I don't believe the API has been touched in any way at all by the admins/curators, if you create your own one here you can look at the settings/options, the possibilities i can think of is that FANDOM wiki's use an outdated API version (which is unlikely), or that FANDOM limits the API in some way, or perhaps its a modified/different API altogether.

from wiki.

dijs avatar dijs commented on September 27, 2024

You are probably right.

I am currently going through all the "Falied" methods you just outlined and trying to fix each one.

This way we support these other versions of the API.

from wiki.

 avatar commented on September 27, 2024

Awesome. P.S There is almost definitely other methods/functions which don't work with this API that I haven't included (for full coverage you may want to check them all).

Also, making the library compatible with that API would make it compatible with all of the FANDOM-Wikias which is a pretty good change/update.

from wiki.

dijs avatar dijs commented on September 27, 2024

Totally agree.

from wiki.

dijs avatar dijs commented on September 27, 2024

Okay, been doing some research on some of the queries I run.

Here is an example.

In order to extract out the summary from the page, it looks like the query I use is based on a API "Extension". I am guessing these need to be turned on or installed I guess...

https://www.mediawiki.org/wiki/Extension:TextExtracts

from wiki.

dijs avatar dijs commented on September 27, 2024

I am crawling through this MediaWiki API documentation and am NOT finding any other way to extract text like I do now.... :/ This extension may be our only solution right now.

from wiki.

 avatar commented on September 27, 2024

http://oldschoolrunescape.wikia.com/wiki/Special:Version
http://community.wikia.com/wiki/Help:Extensions

There may be some helpful information on these pages, the first one shows the installed extensions and software versions

EDIT: Is this a solution? https://github.com/Wikia/app/tree/dev/extensions/wikia/MercuryApi (This extension is installed by default on FANDOM Wikias and may have what you need)

from wiki.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.