Movatterモバイル変換


[0]ホーム

URL:


Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview
List overview
Download

Mediawiki-apiDecember 2012

mediawiki-api@lists.wikimedia.org
  • 21 participants
  • 16 discussions
Start a nNew thread

20 Jan '26
Hi there,I'm using the API to extract the raw wiki text from my pages, usingthe "?action=query&titles=Main_Page&export&exportnowrap" syntax. Thatworks perfectly.Now I would like to get the templates expanded out in the result, so Iuse: "?action=query&titles=Main_Page&prop=revisions&rvlimit=1&rvprop=content&rvexpandtemplates",which does the job, as expected, but it also strips out the comments.My problem is that the comments are meaningful to me (I use them tohelp process the wiki text in subsequent steps).Is there a way to expand templates with the API, but leave thecomments intact?Thanks,Kevin
4 5
0 0
Need to extract abstract of a wikipedia page
by aditya srinivas 23 Nov '23

23 Nov '23
Hello,I am writing a Java program to extract the abstract of the wikipedia pagegiven the title of the wikipedia page. I have done some research and foundout that the abstract with be in rvsection=0 So for example if I want the abstract of 'Eiffel Tower" wiki page then I amquerying using the api in the following way.http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Eiffel…and parse the XML data which we get and take the wikitext in the tag <revxml:space="preserve"> which represents the abstract of the wikipedia page.But this wiki text also contains the infobox data which I do not need. Iwould like to know if there is anyway in which I can remove the infobox dataand get only the wikitext related to the page's abstract Or if there is anyalternative method by which I can get the abstract of the page directly.Looking forward to your help.Thanks in AdvanceAditya Uppu
4 3
0 0
APIv2 alpha implementation
by Yuri Astrakhan 09 Jan '13

09 Jan '13
It's almost New Year, and time for presents (according to the Russiantraditions).I hereby present you the API versioning framework. Navigate tohttps://gerrit.wikimedia.org/r/#/c/41014/ and get that patch to your localinstallation for a test run.There shouldn't be any visible functionality changes. At least that was thegoal. But now we can easily add a new version module or a submodule(prop/list/etc) without breaking existing code.To see it in action -- in ApiMain.php, add this line into $Modules array: 'query2' => 'ApiQuery',it adds another version of query implemented by the same existing class.now if you look athttp://localhost/api.php you will see* action=query * This module is obsolete. See old documentation atapi.php?action=help&modules=query* action=query2 *... -- the regular query parameters -- ...both query and query2 will work identically in this example unless youchange ApiQuery.php.Let the rotten egg throwing commence!Once we settle on this, I propose you join me at the mediawiki labs --https://labsconsole.wikimedia.org/wiki/Nova_Resource:Mediawiki-apito develop and test the actual changes to the APIv2 interface. To keep itgoing full steam ahead, I will accept ideas, criticisms, cookies, codepatches, small unmarked bills and large paychecks, but most importantly -your time analyzing and commenting this effort.--Yurik
4 12
0 0
returning string from api extension
by webmaster@numerica.cl 07 Jan '13

07 Jan '13
Greetings from ChileJust wanted to ask if anyone thinks it's possible to return just a string (and not an array) from an API extension?I've been looking at ApiBase.php and ApiResult.php and it seems it's not, is it?Thanks in advance.Numerico
4 8
0 0
Excluding hidden categories
by Robert Crowe 01 Jan '13

01 Jan '13
I'm querying the API to get the categories and subcategories for a page, andI'd like to be able to exclude hidden categories and administrationcategories from the result. The queries that I currently use look likethis: Category Pages:http://en.wikipedia.org/w/api.php?action=query&titles=Category:$catname&cmtitle=Category:$catname&list=categorymembers&cmlimit=500&prop=categories&format=php Non-Category Pages:http://en.wikipedia.org/w/api.php?action=parse&page=$pagename&prop=text|categories&redirects&format=php where $catname and $pagename are replaced by the page titles. Is there away to either exclude categories that are hidden categories, or that aresubcategories of the "Category:Hidden categories" category? Thanks, Robert
2 1
0 0

31 Dec '12
Folks,Can anyone please tell me the most reliable way to request an article page using Media wiki API without fear of getting redirected?I found that using title to query is not reliable as I have seen titles changing when more articles with same/similar titles are being added. Some of the older titles now lead to generic page stating this title might mean one of the following in the list and a list of article pages links are shown below this message. . I want to avoid getting redirected to this generic page and always stay on the article page as I plan to show this Wikipedia content on my numerous sub-domain home pages.Is there a page id that I can use which doesn't change at all and is always associate to same article? If so, how can I query the page id using current titles? Any examples and pointers is very much appreciated. Thanks,Ravi
3 4
0 0

31 Dec '12
Hi,I am currently working on a project which involves using the wikipediacontent. The expected traffic that our system needs to serve is around 200qps during peak time.My question is if using Media WIKI directly is really my option here (Imean sending get requests tohttp://en.wikipedia.org/w/api.php ridectlywithout any local mirror). Would this traffic be supported or banned?Also what about the availability of the service and possible latencies?If it was banned what is the best approach?Thanks in advance for any answer.Ewa Szwed
2 2
0 0
API versionning strategy
by Yuri Astrakhan 23 Dec '12

23 Dec '12
I would like to get some feedback on how best to proceed with the futureAPI versions. There will be breaking changes and desires to cleanup,optimize, obsolete things, so we should start thinking about it. I see twogeneral approaches I would really like to hear your thoughts on -- a globalAPI version versus each module having its own version. Both seem to havesome pros and cons.== Per API ==A global version=42 parameter will be included in all calls to API,specifying what functionality client is expecting. The number wouldincrease every so often, like once a month to signify "API changes bucket".Every module will have this type of code when processing input parametersand generating reply:// For this module:breakingChangeAversion = 15breakingChangeBversion = 38...if requestVersion < breakingChangeAversion reply as originally implementedelse if requestVersion < breakingChangeBversion reply as after breaking change Aelse reply as after breaking change BPROS: simple, allows the whole API to introduce global breaking changeslike new error reporting.CONS: every module writer has to check the current number at the APIwebsite before hard-coding a specific number into their module. Theremight also some synchronicity issues between module authors - making achange within a short time but long enough for a client writer to hard codethe number while only knowing about one's changes. and assuming no changesto other modules.== Per module ==Each module name is followed by "_###" string. API ? action=Query_2 &titles=...Modules stay independent, each client knows just the modules it needs withtheir versions.PROS: keeps things clean and separate. Each version is increased only byindividual module writer due to a breaking change.CONS: it becomes impossible to make a breaking change in the "core" of theAPI, like maybe global parameters, a different system of error reporting,etc. I am not sure we have any of this, but...?At the moment, I am still leaning towards the per-module approach as itseems cleaner.For the version number itself, I think a simple integer would suffice -client specifies which interface version it wants, server responds in thatformat or returns an error. A complex 2.42.0.15 is not needed here - theclient will know at the time of writing what version it supports. If theserver can't reply with that request, it will fail. Knowing sub-numberswouldn't help, but only complicate things.Lets hope this will be a short and constructive thread of good new ideas :)
4 9
0 0
beta readers wanted for new RESTful Web APIs book
by Sumana Harihareswara 23 Dec '12

23 Dec '12
(warning: conflict of interest)My spouse, Leonard Richardson, is working on a new book for O'Reilly:"RESTful Web APIs, a follow-up to 2007's RESTful Web Services". It'llcome out next year. Those of you who are interested in RESTful web APIdesign (paging Federico!) might want to sign up to be beta readers.http://www.crummy.com/2012/12/21/1Leonard also wants to hear about interesting or odd domain-specific datastandards and hypermedia formats.-- Sumana HarihareswaraEngineering Community ManagerWikimedia Foundation
2 1
0 0
Migrating to "dumb query-continue"
by Yuri Astrakhan 20 Dec '12

20 Dec '12
Hi everyone, there seem to have been many great changes in the API, so Idecided to take a look at improving my old bots a bit, together with therest of the pywiki framework. While looking, a few thoughts and questionshave occured that I hope someone could comment on.I have been out of the loop for a long time, so do forgive me if Imisunderstand some recent changes and how they are suppose to work, or ifthis is a non-issue. Also I appologise if these issues have already beendiscussed and/or resolved.My first idea for this email is "*dumb continue*":Can we change the continue so that clients are not required to understandparameters once the first request has been made? This way a user of aclient library can iterate over query results without knowing how tocontinue, and the library would not need to understand what to do with eachparameter (iterator scenario):for datablock in mwapi.Query( { generator=*allpages*, prop=*links|categories*, otherParams=... } ): # # Process the returned data blocks one at a time #The way it is done now, Query() method must understand how to do continuein depth. Which parameters to look at first, which - at second, how tohandle when there are no more links while there are more categories toenumerate.Now there is even a high bug potential -- if there are no more links, APIreturns just two continues - clcontinue & gapcontinue - which means that ifthe client makes the same request with the two additional "continue"parameters, API will return the same result again, possibly producingduplicate errors and consuming extra server resources.*Proposal:*Query() method from above should be able to take ALL continue values andappend ALL of them to the next query, without knowing anything about them,and without removing or changing any of the original request parameters.Query() will do this until server returns a data block with no more<query-continue> section.Also, because the "page" objects might be incomplete between different datablocks, the user might need to know when a complete "page" object isreturned. API should probably introduce an "incomplete" attribute on thepage to indicate that the client should merge it with the page from thefollowing data blocks with the same ID until there is no more "incomplete"flag. Page revision number could be used on the client to see if the pagehas been changed between calls:for page in mwapi.QueryCompletePages( { same parameters as example above }): # process each page*API Implementation details:*In the example above where we have a generator & two properties, the nextcontinue would be set to the very first item that had any of the propertiesincomplete. The properties continue will be as before, except that if thereis no more categories, clcategory is set to some magic value like '|' toindicate that it is done and no more SQL requests to categories tables areneeded on subsequent calls.The server should not return the maximum number of pages from thegenerator, if properties enumeration have not reached them yet (e.g. ifgeneratorLimit=max & linksLimit=1 -> will return just the first page withone link on each return)*Backwards compatibility:*This change might impact any client that will use the presence of the"plcontinue" or "clcontinue" fields as a guide to not use the next"gapcontinue". The simplest (and long overdue) solution is to add the"version=" parameter.While at it, we might want to expand the action=paraminfo to includemeaninful version data. Better yet, make a new "moduleinfo" action thatreturns any requested specifics about each module, e.g.:action=moduleinfo & modules= parse | query | query+allpages & props=version | paramsThanks! Please let me know what you think.--Yuri
4 24
0 0
Results per page:

[8]ページ先頭

©2009-2026 Movatter.jp