【发布时间】:2020-08-02 07:52:34
【问题描述】:
我想一次收集所有的修订历史数据。 Pywikibot page.revisions() 没有获取更改的字节数的参数。 它为我提供了我需要的所有数据,除了更改的字节数。
如何获取更改的字节数?
例如: 对于文章主页,修订历史为here: history screenshot
我当前的代码:
import pywikibot
site = pywikibot.Site("en", "wikipedia")
page = pywikibot.Page(site, "Main_Page")
revs = page.revisions()
仅显示 1 个输出:
first entry: {'revid': 969106986, '_text': None, 'timestamp': Timestamp(2020, 7, 23, 12, 44, 21), 'user': 'The Blade of the Northern Lights', 'anon': False, 'comment': 'OK, there we go.', 'minor': False, 'rollbacktoken': None, '_parent_id': 969106918, '_content_model': None, '_sha1': 'eb9e0167aabe4145be44305b3775837a37683119', 'slots': {'main': {'contentmodel': 'wikitext'}}}
我需要更改的字节数,在修订历史链接中显示为 {+1, -1, +1, -2},也可以在上面的历史截图中看到。
【问题讨论】:
标签: web-scraping mediawiki wikipedia-api pywikibot