문제

In Wikipedia (and other Mediawiki servers), each page has history, and each point in history is identified with its oldid.

How to retrieve the current oldid (current version) of http://server/wiki/Article?

With the Mediawiki API, preferably retrieving only that.
For intergration in a bash script.

도움이 되었습니까?

해결책

The info operation of the Mediawiki API gives it, among other information:

HTTP request:

http://en.wikipedia.org/w/api.php?action=query&prop=info&format=xml&titles=Main%20Page

HTTP response:

<?xml version="1.0"?>
<api>
  <query>
    <pages>
      <page pageid="15580374" ns="0" title="Main Page" contentmodel="wikitext"
        pagelanguage="en" touched="2014-01-21T08:00:12Z" lastrevid="574690625"
        counter="" length="6391" />
    </pages>
  </query>
</api>

The part you want is lastrevid.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top