Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to retrieve a page from esolangs.org -- gets "The action specified by the URL is invalid" for Query {"meta"=>"siteinfo"} #84

Open
Nakilon opened this issue Dec 23, 2020 · 3 comments

Comments

@Nakilon
Copy link

Nakilon commented Dec 23, 2020

Infoboxer.wiki('https://esolangs.org/').get('Category:Implemented')
=> #<JSON::ParserError: 784: unexpected token at '<!DOCTYPE html>

The page says:

The action specified by the URL is invalid.

Byebug says the request is #<MediaWiktory::Wikipedia::Actions::Query {"meta"=>"siteinfo"}>

@zverok
Copy link
Contributor

zverok commented Dec 23, 2020

Infoboxer.wiki('https://esolangs.org/w/api.php').get('Category:Implemented')
# => #<Page(title: "Category:Implemented", url: "https://esolangs.org/wiki/Category:Implemented"): The languages in this category ...>

The URL should be the base URL for the API. It can be /w/api.php, or just /api.php, or sometimes /wiki/api.php, so we don't try to guess. Though the error message should definitely be more obvious! (Like, check the most basic response and say "It is not an API endpoint" if it is wrong)

@Nakilon
Copy link
Author

Nakilon commented Dec 23, 2020

Oh, the /w/api.php wasn't obvious because README says:

# From any wiki with the same engine:
page = Infoboxer.wiki('http://companywiki.com').get('Our Product')

After creating this ticket I used another gem like this:

MediaWiki::Butt.new "https://esolangs.org/w/api.php"

that needs this suffix too but I didn't realise I could come back to the Infoboxer gem with this edit because I didn't even notice it since I'm not generally familiar with Mediawiki API.


Thanks for very quick response. The ticket can be closed if you are not going to keep it as a reminder to improve the error message or something.

@zverok
Copy link
Contributor

zverok commented Dec 23, 2020

Yeah, that was clear once (in docs and errors), and then on one of the last big redesign, it got lost :( Sorry.

I'll keep it as a reminder, yeah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants