Live data from Hacker News

Ask HN: Has anyone had luck using the Wikipedia data dumps?

news.ycombinator.com

11–14 of 14 posts

Re: Ask HN: Has anyone had luck using the Wikipedia data dumps?

#11
post #3

I use Kiwix to do that. Much simpler. Plus they provide other dumps too. So allows you to play with say wikipedia and stackoverflow simultaneously.

That is really cool.. had not seen this before.. I do think the intention is api access to this data not browser.

Re: Ask HN: Has anyone had luck using the Wikipedia data dumps?

#14
I used Python to load the contents of the articles into a DB (potentially wrong extract of veeery old code - I have something like 20 different versions lying around therefore I'm not 100% sure that this did work well):

===

  import xml.dom.pulldom as pulldom
  from lxml import etree
  from xml.etree import ElementTree as ET
  sInputFileName = "/my/input/wiki_file.xml"
  context = etree.iterparse(sInputFileName, events=('end',), tag='doc')

  for event, elem in context:
    iThisArticleCharLength = len(elem.text)
    sPageURL = elem.get("url")[0:4000]
    sPageTitle = elem.get("title")[0:4000]
    SPageContents = elem.text

    
===
Post reply on HN