I'm trying to retrieve all the templates from a page as XML strings so that I can retrieve their parameters and values. For that I'm using the "expandtemplates" action with "generatexml" set to true. It works well for very small articles however not for large ones (above approx. 2000 characters). In this cases, the API fails because the query string is too big (Error ERR_TOO_BIG).
Is there any way around this issue? Or maybe I'm not using the right approach? Any help would be appreciated.
Thanks,
Laurent
On Thu, Oct 29, 2009 at 05:51:18PM +0000, Laurent wrote:
I'm trying to retrieve all the templates from a page as XML strings so that I can retrieve their parameters and values. For that I'm using the "expandtemplates" action with "generatexml" set to true. It works well for very small articles however not for large ones (above approx. 2000 characters). In this cases, the API fails because the query string is too big (Error ERR_TOO_BIG).
If you're using GET, try POST instead.
2009/10/29 Laurent laurent1979@gmail.com:
I'm trying to retrieve all the templates from a page as XML strings so that I can retrieve their parameters and values. For that I'm using the "expandtemplates" action with "generatexml" set to true. It works well for very small articles however not for large ones (above approx. 2000 characters). In this cases, the API fails because the query string is too big (Error ERR_TOO_BIG).
Is there any way around this issue? Or maybe I'm not using the right approach? Any help would be appreciated.
Are you grabbing a page's content in one request (prop=revisions), then feeding it to action=expandtemplates in a second request? In that case, you can take a shortcut by passing the &rvexpandtemplates&rvgeneratexml parameters to prop=revisions.
Roan Kattouw (Catrope)
2009/10/30 Roan Kattouw roan.kattouw@gmail.com:
2009/10/29 Laurent laurent1979@gmail.com:
I'm trying to retrieve all the templates from a page as XML strings so that I can retrieve their parameters and values. For that I'm using the "expandtemplates" action with "generatexml" set to true. It works well for very small articles however not for large ones (above approx. 2000 characters). In this cases, the API fails because the query string is too big (Error ERR_TOO_BIG).
Is there any way around this issue? Or maybe I'm not using the right approach? Any help would be appreciated.
Are you grabbing a page's content in one request (prop=revisions), then feeding it to action=expandtemplates in a second request? In that case, you can take a shortcut by passing the &rvexpandtemplates&rvgeneratexml parameters to prop=revisions.
Roan Kattouw (Catrope)
I'm doing the same thing for a couple of thousand articles a day the way Roan suggests and it works fine for me. One thing I notice though is it gets slow and it can only do whole pages. Would it be possible to allow it to work just with sections? I'm interested in Infoboxes which are always in section 0.
Andrew Dunbar (hippietrail)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
2009/10/30 Andrew Dunbar hippytrail@gmail.com:
I'm doing the same thing for a couple of thousand articles a day the way Roan suggests and it works fine for me. One thing I notice though is it gets slow and it can only do whole pages. Would it be possible to allow it to work just with sections? I'm interested in Infoboxes which are always in section 0.
Doesn't &rvsection=0 work?
Roan Kattouw (Catrope)
2009/10/30 Roan Kattouw roan.kattouw@gmail.com:
2009/10/30 Andrew Dunbar hippytrail@gmail.com:
I'm doing the same thing for a couple of thousand articles a day the way Roan suggests and it works fine for me. One thing I notice though is it gets slow and it can only do whole pages. Would it be possible to allow it to work just with sections? I'm interested in Infoboxes which are always in section 0.
Doesn't &rvsection=0 work?
I take that back. I am indeed getting only section 0. Sorry about that.
Andrew Dunbar (hippietrail)
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org