If you only have a URL and donโt know anything about the wiki, you cannot assume that the part after the last /
is the title of the page, as the MediaWiki page names may contain /
. Instead, you will need to start by querying the siteinfo API, for example:
https:
In the answer of query.general.server
and query.general.articlepath
in the union, you get the url structure, and query.general.script
will provide you with a scriptpath . Depending on where your URL came from, you will need their stand to account for the default //mywiki/scriptpath/index.php?title=Namespace:Foo/Bar
and the short form URL //mywiki/articlepath/Namespace:Foo/Bar
for an article named Foo/Bar
.
To make matters worse, the slash in the title of the article can be either part of the name or a separator for the subpage, depending on the settings of this namespace!
If you know the wiki URL syntax, at hand @ Seb35 has already answered all your questions.
source share