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.
Motivation example:
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:
api.php?sql=SELECT+DISTINCT...
(maybe use no CAPS in the examples to "sell the ease of the idea".)
Hi,
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? :-)
Thanks,
Bob
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
103251 or
$ GET $@/index.php?title=Special:Version |wc -c
11197
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
1372
and then at least get with perl -nwle '/>(.*alpha.*)</ && print $1'
MediaWiki 1.15alpha
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
undesired characteristics:
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ŋ
amaˈdeus ˈmoËtsart]).
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.
--
Jeffrey Barish
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
format?
for f in json jsonfm php phpfm wddx wddxfm xml xmlfm yaml yamlfm rawfm txt txtfm dbg dbgfm
do
printf "$f\t"
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
jsonfm 0
rawfm 0
dbg 24 #good
dbgfm 24
php 24
phpfm 24
txt 24
txtfm 24
wddxfm 24
xml 24
xmlfm 24
yaml 24
yamlfm 24
wddx 48 #weird, mangled?
Hi all,
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,
api.php?action=query&generator=allpages&prop=info .
Pilot error surely, but still, how can I set the namespace?
Hello,
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
too long...
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.
Thanks,
Ryan
Hello
I tryed to found in Media-Wiki API if it was possible to get the ip address
from all the users (both register and anonymus users) but with no success.
Can anybody help me?
Thanks in advance