Hi all,
I'm trying to parse the update feed from the wiki, and what I'd hoped to do was to determine the kind of update via the namespace property of the returned dictionary. It seemed that
* "ns=0" gives a composition (this seems to work fine), and
* "ns=14" would give a composer. This doesn't work out so well. I get composers in most instances, but for the latest update query, I got back also "Category:User baroque flutists-3" and "Category:User baroque flutists".
Are the items with "Baroque flutists" etc an anomaly with the data, or are the namespaces not completely implemented yet?
Alternatively, if this isn't the best way to get the latest updates and additions to the wiki via the API, any other suggestions?
Here's the query I'm using: http://imslp.org/api.php?action=query&l ... ormat=json
(rcstart is set to the last time my app pulled data from the wiki).
Thanks much,
Gardano
Wiki Namespaces
Re: Wiki Namespaces
Perhaps 'ns=14' would just signify a category? Composers are not in a separate namespace than the other categories (such as those for tags, templates, etc.), so I'd imagine that it would be difficult to tell the difference using this method. Is there any way to modify the query to check what categories the page is included in? (Should be in Category:Composers in this case)
Re: Wiki Namespaces
KGill is right. NS_CATEGORY is defined as 14. Category:Composers should contain all composer categories.
Re: Wiki Namespaces
Oh, OK. I'm sure I made the invalid assumption purely because most new categories are of composers, but not all. I'll have to look through the API and see if I can pre-filter the requests, or alternatively, find a way to filter the requests by calling the API again. This last option of course is not optimal because I want to keep the HTTP Requests to a minimum, both for the device and for the server's sake.imslp wrote:KGill is right. NS_CATEGORY is defined as 14. Category:Composers should contain all composer categories.
I'll have to find out what unique property distinguishes a composer from, say, a user.
Thanks!
Gardano
Re: Wiki Namespaces
Hmm, would list=categorymembers on Category:Composers work?
Re: Wiki Namespaces
:¬) Yep, I'm doing that for the initial load of the composers. What I'm trying to do with this query is to refresh the app with all new compositions and composers since the last time the app was launched.imslp wrote:Hmm, would list=categorymembers on Category:Composers work?
AHHH now that I think of it, I really only need to identify the new *compositions* that have been added. If there is no composer foreign-keyed to the new composition, then I'd know that I need to do a query on that composition to grab its composer.
So I can use the NS=0 to grab compositions and that will be all I need.
-
- active poster
- Posts: 504
- Joined: Fri Dec 19, 2008 8:36 pm
- notabot: YES
- notabot2: Bot
- Location: Berlin, Germany
Re: Wiki Namespaces
Now, that is something I have been looking for on imslp for a long time, would your app also work in a regular browser?gardano wrote
What I'm trying to do with this query is to refresh the app with all new compositions and composers since the last time the app was launched.
Re: Wiki Namespaces
Actually, I don't know. This is something for the iPad app I'm writing for IMSLP, and so it's more technical and doesn't return content appropriate for a web browser. I haven't looked into how it would work using just a web browser, I'm afraid.kalliwoda wrote:Now, that is something I have been looking for on imslp for a long time, would your app also work in a regular browser?gardano wrote
What I'm trying to do with this query is to refresh the app with all new compositions and composers since the last time the app was launched.
--Gardano