Platonides | 1 Jan 21:51 2012
Picon

Re: can I use the API to search for images in commons.wikimedia.org?

On 30/12/11 21:01, Timothy Helck wrote:
> Roan,
>
> I've looked at search, but it only seems to return names of pages, not
> images. Is there a way to make it return images?
>
> Tim

Files are at namespace 6, which wasn't included in the provided query:
https://commons.wikimedia.org/w/api.php?action=query&list=search&srnamespace=6&srsearch=%22chartres+cathedral%22
Platonides | 1 Jan 22:01 2012
Picon

Re: How to parse the contents

On 31/12/11 18:08, kracekumar ramaraju wrote:
>     The API does not provide a way to get just the IPA pronunciation, or
>     just the synonyms, or fetch any other semantic information. The only
>     thing that is offered is separation into sections using ==Headers== ,
>     for anything else you'll have to extract the information yourself
>     AFAIK.
>
> Instead of separating contents with ==Headers== it will be freaking
> awesome if it is returned as array, This makes easy for end users. Else
> I need to write my own parser.

The API is content-agnostic. A wiki could contain the IPA pronunciation 
inside {{IPA|...}}, another could mark the definition with <font 
color="green"> </font> and most wouldn't even contain IPA not 
definitions (eg. it could be granny's blog).

That means that usually, you need to make your wiki-specific parser to 
fetch the pieces relevant for you.
b-jorsch | 3 Jan 19:06 2012

API for RevDel?

Is it possible to use Revision deletion via the API, or has the
necessary module not been written yet?
Abhishek | 8 Jan 12:44 2012
Picon

Get metadata for old revisions

Hello all,

I'm looking to get imageinfo type information for two different revisions of the same page.

I'm thought the following would work: (revids are both for the page on Yogi Berra)

http://en.wikipedia.org/w/api.php?action=query&format=xml&prop=images&revids=254862759

http://en.wikipedia.org/w/api.php?action=query&format=xml&prop=images&revids=462841413

However both these queries give me the same response. Something I'm doing wrong? How should I go about doing this?

Abhishek
------------
http://abhishek.mit.edu

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Petr Onderka | 8 Jan 13:07 2012
Picon

Re: Get metadata for old revisions

Hi,

the prop=images query uses the imagelinks table[1] that doesn't store
information about old revisions.

The only place where the information you want is still present is the
actual text of the old revision. I think your only chance is to
retrieve that text and parse it yourself, looking for the images.

[1]: http://www.mediawiki.org/wiki/Manual:Imagelinks_table

Petr Onderka
[[User:Svick]]

On Sun, Jan 8, 2012 at 12:44, Abhishek <abhishek.nagaraj <at> gmail.com> wrote:
> Hello all,
>
> I'm looking to get imageinfo type information for two different revisions of
> the same page.
>
> I'm thought the following would work: (revids are both for the page on Yogi
> Berra)
>
> http://en.wikipedia.org/w/api.php?action=query&format=xml&prop=images&revids=254862759
>
> http://en.wikipedia.org/w/api.php?action=query&format=xml&prop=images&revids=462841413
>
> However both these queries give me the same response. Something I'm doing
> wrong? How should I go about doing this?
>
> Abhishek
> ------------
> http://abhishek.mit.edu
>
> _______________________________________________
> Mediawiki-api mailing list
> Mediawiki-api <at> lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>
Fred Zimmerman | 9 Jan 21:12 2012

can't figure out Xpath to query text and url nodes for SearchSuggestion using xmlstarlet

I am having trouble figuring out how to give XMLStarlet the right Xpath to query nodes  in a Wikipedia XML document. This is an xpath problem, really, not a starlet problem.  I don't understand how to formulate the xpath portion of the xmlstarlet call.  Help!

curl "http://en.wikipedia.org/w/api.php?action=opensearch&search=Bullwinkle&namespace=0&format=xml" -o bullwinkle.xml
 
returns: 
?xml version="1.0"?>
<SearchSuggestion version="2.0" xmlns="http://opensearch.org/searchsuggest2">
<Query xml:space="preserve">Bullwinkle</Query>
<Section>
<Item>
<Text xml:space="preserve">Bullwinkle</Text>
<Description xml:space="preserve">Bullwinkle may refer to:</Description>
<Url xml:space="preserve">http://en.wikipedia.org/wiki/Bullwinkle</Url>
</Item>
<Item>
<Text xml:space="preserve">Bullwinkle J. Moose</Text>
<Description xml:space="preserve">Bullwinkle J. </Description>
<Url xml:space="preserve">http://en.wikipedia.org/wiki/Bullwinkle_J._Moose</Url> ...

I try: 
 xmlstarlet sel -N x=http://opensearch.org/searchsuggest2 -t -v "count(/SearchSuggestion/Section/ <at> Item)" bullwinkle.xml

which I want to count the items, but it won't.  

WHat I am working to do is to extract the text and url values and put them into a csv file. How to do this is explained at http://xmlstar.sourceforge.net/doc/UG/ch04s01.html (about 2/3 way down) but you have to know how to formulate the xpath for the source xml doc--which I don't!

Any help would be much appreciated.

-----------------------------------------------------
Subscribe to the Nimble Books Mailing List  http://eepurl.com/czS- for monthly updates

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
b-jorsch | 9 Jan 23:34 2012

Re: can't figure out Xpath to query text and url nodes for SearchSuggestion using xmlstarlet

On Mon, Jan 09, 2012 at 03:12:23PM -0500, Fred Zimmerman wrote:
> > count(/SearchSuggestion/Section/ <at> Item)

That's looking for the "Item" in <Section Item="...">, of which none
exist in the document. Lose the  <at>  and it might work.
Fred Zimmerman | 10 Jan 00:09 2012

Re: can't figure out Xpath to query text and url nodes for SearchSuggestion using xmlstarlet

bitnami <at> ip-10-212-187-224:~/sfb-link/scripts$ xmlstarlet sel -N x=http://opensearch.org/searchsuggest2 -t -v "/SearchSuggestion/Section/Item" bullwinkle.xml
bitnami <at> ip-10-212-187-224:~/sfb-link/scripts$

that doesn't work (null response). not sure whether it's xpath or my lack of understanding of xmlstarlet.

-----------------------------------------------------
Subscribe to the Nimble Books Mailing List  http://eepurl.com/czS- for monthly updates



On Mon, Jan 9, 2012 at 17:34, <b-jorsch <at> alum.northwestern.edu> wrote:
On Mon, Jan 09, 2012 at 03:12:23PM -0500, Fred Zimmerman wrote:
> > count(/SearchSuggestion/Section/ <at> Item)

That's looking for the "Item" in <Section Item="...">, of which none
exist in the document. Lose the <at> and it might work.

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Petr Onderka | 10 Jan 16:30 2012
Picon

Re: can't figure out Xpath to query text and url nodes for SearchSuggestion using xmlstarlet

If you define namespace alias (in your case "x"), you also have to
actually use it in the query:

xmlstarlet sel -N x=http://opensearch.org/searchsuggest2 -t -v
'count(/x:SearchSuggestion/x:Section/x:Item)' bullwinkle.xml

The command above works for me and returns "7".

And as far as I know, you have to use namespace aliases when working with XPath.

Petr Onderka
[[User:Svick]]

On Tue, Jan 10, 2012 at 00:09, Fred Zimmerman <wfz <at> nimblebooks.com> wrote:
> bitnami <at> ip-10-212-187-224:~/sfb-link/scripts$ xmlstarlet sel -N
> x=http://opensearch.org/searchsuggest2 -t -v
> "/SearchSuggestion/Section/Item" bullwinkle.xml
> bitnami <at> ip-10-212-187-224:~/sfb-link/scripts$
>
> that doesn't work (null response). not sure whether it's xpath or my lack of
> understanding of xmlstarlet.
>
> -----------------------------------------------------
> Subscribe to the Nimble Books Mailing List  http://eepurl.com/czS- for
> monthly updates
>
>
>
> On Mon, Jan 9, 2012 at 17:34, <b-jorsch <at> alum.northwestern.edu> wrote:
>>
>> On Mon, Jan 09, 2012 at 03:12:23PM -0500, Fred Zimmerman wrote:
>> > > count(/SearchSuggestion/Section/ <at> Item)
>>
>> That's looking for the "Item" in <Section Item="...">, of which none
>> exist in the document. Lose the  <at>  and it might work.
>>
>> _______________________________________________
>> Mediawiki-api mailing list
>> Mediawiki-api <at> lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>
>
>
> _______________________________________________
> Mediawiki-api mailing list
> Mediawiki-api <at> lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Fred Zimmerman | 10 Jan 16:39 2012

Re: can't figure out Xpath to query text and url nodes for SearchSuggestion using xmlstarlet

thanks!

-----------------------------------------------------
Subscribe to the Nimble Books Mailing List  http://eepurl.com/czS- for monthly updates



On Tue, Jan 10, 2012 at 10:30, Petr Onderka <gsvick <at> gmail.com> wrote:
If you define namespace alias (in your case "x"), you also have to
actually use it in the query:

xmlstarlet sel -N x=http://opensearch.org/searchsuggest2 -t -v
'count(/x:SearchSuggestion/x:Section/x:Item)' bullwinkle.xml

The command above works for me and returns "7".

And as far as I know, you have to use namespace aliases when working with XPath.

Petr Onderka
[[User:Svick]]

On Tue, Jan 10, 2012 at 00:09, Fred Zimmerman <wfz <at> nimblebooks.com> wrote:
> bitnami <at> ip-10-212-187-224:~/sfb-link/scripts$ xmlstarlet sel -N
> x=http://opensearch.org/searchsuggest2 -t -v
> "/SearchSuggestion/Section/Item" bullwinkle.xml
> bitnami <at> ip-10-212-187-224:~/sfb-link/scripts$
>
> that doesn't work (null response). not sure whether it's xpath or my lack of
> understanding of xmlstarlet.
>
> -----------------------------------------------------
> Subscribe to the Nimble Books Mailing List  http://eepurl.com/czS- for
> monthly updates
>
>
>
> On Mon, Jan 9, 2012 at 17:34, <b-jorsch <at> alum.northwestern.edu> wrote:
>>
>> On Mon, Jan 09, 2012 at 03:12:23PM -0500, Fred Zimmerman wrote:
>> > > count(/SearchSuggestion/Section/ <at> Item)
>>
>> That's looking for the "Item" in <Section Item="...">, of which none
>> exist in the document. Lose the <at> and it might work.
>>
>> _______________________________________________
>> Mediawiki-api mailing list
>> Mediawiki-api <at> lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>
>
>
> _______________________________________________
> Mediawiki-api mailing list
> Mediawiki-api <at> lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Gmane