Why not allow arbitrary SQL queries on most of the database tables?
Let's see, only a few, like the user table, have much confidential
information, and even only a few columns of it too.
So api.php could drop its read privileges for (parts of?) that table
before running any queries.
It comes the time when all websites should check for link lint.
OK, so I need a list of external links that are present in my wikis.
$ echo "SELECT DISTINCT el_to FROM wiki_externallinks ORDER BY el_to;"|
mysql -B my_database
gets it for me all with one command.
Can api.php get all the external links, for all namespaces, all in one shot?
Can Special:Linksearch get them all either, all in one shot?
The sysop could also customize what tables/columns to restrict, and
how many rows to output. Also set the total row output limit too.
No need for only allowing SELECT, as api.php would first drop all
other privileges than read-only privileges, including the privilege to
GRANT its privileges back to itself... No need to even filter against
SQL injection attacks (but as I don't even know how to spell SQL,
don't quote me on that.)
Anyway, being able to do arbitrary SQL would greatly simplify many
api.php queries. Let's see, for the URL perhaps use:
(maybe use no CAPS in the examples to "sell the ease of the idea".)
I'm using the MW API (very cool, by the way) to perform some basic monitoring on a site that I maintain the content of, but don't have access to the MW backend. I would like to track the number of page views for certain pages, but those counts do not appear to be part of the information returned by any function in the API (that I could find).
Are page hits accessible via the API? If so, how? If not, could you please consider this a feature request? :-)
Gentlemen, (a brand new thread about the version,)
the challenge: get the Mediawiki version from the remote
site but wasting the least amount of bytes to do so.
Currently to just get a piddly 30 bytes,
"MediaWiki: 1.15alpha (r49026)",
one needs at least
$ set http://radioscanningtw.jidanni.org
$ GET $(a)/api.php?version |wc -c
$ GET $@/index.php?title=Special:Version |wc -c
Just to be able to pipe it to w3m -dump -T text/html|grep alpha
OK, I can cheat
$ GET "$(a)/api.php?action=query&export&exportnowrap" |wc -c
and then at least get with perl -nwle '/>(.*alpha.*)</ && print $1'
I am writing a PyGTK application. I would like to be able to download text
only (with formatting) from Wikipedia and display it in my application. I
think that I am close to a solution, but I have reached an impasse due to my
ignorance of most of the mediawiki API.
My plan has been to use GtkMozembed in my application to render the page, so I
need to retrieve html. What is close to working is to use the index.php API
with action=render and title=<search string for the Wikipedia page>. The
data that I retrieve does display in my browser, but it has the following
1. All images appear (I want none).
2. There are sections at the end that I don't want (Further reading, External
links, Notes, See also, References).
3. Some characters are not rendered correctly (e.g., IPA: [ËˆvÉ”lfgaÅ‹
To fix 1 and 2, I could perhaps use an html parser and delete the offending
items, but I wonder whether there is a proper solution using the mediawiki
API (such as a prop parameter with which I could at least specify that I
don't want any images).
I assume that 3 is a unicode problem, but I don't know what to do to fix it.
Just curious, are formats json, jsonfm, and rawfm not supposed to pass
UTF-8 unescaped, and format wddx supposed to turn it into some other
for f in json jsonfm php phpfm wddx wddxfm xml xmlfm yaml yamlfm rawfm txt txtfm dbg dbgfm
GET -P "http://radioscanningtw.jidanni.org/api.php?action=query&list=allpages&apfro…"|
perl -pwe 's/[[:ascii:]]//g'|wc -c
done|sort -k 2
json 0 #no UTF-8, all got escaped
dbg 24 #good
wddx 48 #weird, mangled?
I really like your API. I'm wondering how do I get the data in xml format of
a page? I've been using wikipedia's example here:
http://en.wikipedia.org/w/api.php, for details, and I can see how to search
for pages, get metadata, and other such nifty stuff. But really all I want
is the content of a page -- how would I, say, get the English wikipedia data
of the page on Albert Einstein in xml format?
http://en.wikipedia.org/w/api.php?action=query something I hope!
Thanks for your help!
Looking at the examples on api.php,
adding a &apnamespace=1 to api.php?action=query&list=allpages works,
but doesn't when added to the next example,
Pilot error surely, but still, how can I set the namespace?
I trying to get earliest revision dates for a set of approximately
4,000,000 Wikipedia articles. Looking at the MediaWiki API, it seems
that the only way to get information on earliest revisions is to query
on one article at a time. For 4,000,000 articles, this will take far
So, my question is: is there any way to query for first revisions in
batches? Alternatively, if there some other source of this
information, such as data dumps? Since I am only looking for the
timestamps of the first revision of each article, I'd like to avoid
downloading complete histories for each article.