I don't know where to put the size argument, here I only managed to get a single edit size:

https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=size&format=xml&titles=United_States_of_America

but I need the size of whole raw content as it is on last revision.

有帮助吗?

解决方案

You are getting that, the page United States of America contains the following 69 bytes:

#REDIRECT [[United States]]

{{Redr|move|from long name|printworthy}}

What this code means is that it's a redirect and the name of the real article is United States.

https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=size&format=xml&titles=United_States

This returns the size you want: 267582 bytes.

Another option would be let the API follow the redirect automatically using redirects:

https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=size&format=xml&titles=United_States_of_America&redirects

其他提示

rvsize does lead to the output of the size of the whole revison.

In your example the size is really only 69 bytes, as you can see when you also read the content:

REDIRECT [[United States]]

{{Redr|move|from long name|printworthy}}

To automatically follow such redirects, use the redirects parameter for resolving redirects - in your case prop=revisions&rvprop=size&titles=United_States_of_America&redirectss which outputs a size of currently 267582 bytes.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top