How to get full Wikipedia revision-history list from some article?

后端 未结 2 1689
攒了一身酷
攒了一身酷 2021-01-06 01:11

How can I get the full Wikipedia revision-history list? (Don\'t want to scrape)

import wapiti
import pdb
import pylab as plt  
client = wapiti.WapitiClient(\         


        
2条回答
  •  鱼传尺愫
    2021-01-06 01:24

    If you use pywikibot you can pull a generator that will run through the full revision history for you. For example, to get a generator that will step through all the revisions (including their content) for the page "pagename" in English Wikipedia, use:

    site = pywikibot.Site("en", "wikipedia")
    page = pywikibot.Page(site, "pagename")
    revs = page.revisions(content=True)
    

    There's a lot more parameters you can apply to the query. You can find the API documentation here

    Of note is:

    revisions(reverse=False, total=None, content=False, rollback=False, starttime=None, endtime=None)

    Generator which loads the version history as Revision instances.

    pywikibot appears to be the approach taken by many wikipedia editors to automate editing.

提交回复
热议问题