Bundy <[email protected]> writes:
> Hello, I've recently jumped into mwlib and was looking to use it to
> parse a few Wikipedia pages. Old example code I found used the mwapidb
> module, but it seems this has been removed and (I'm guessing) replaced
> by nuwiki. My questions are:
>
> 1. Is there still a VirtualWiki implementation that leverages the
> MediaWiki API? If not, what would be the best alternative where I can
no. mw-zip can be used to download a list of articles and templates used
by those articles.
i.e
,----
| mw-zip -o acdc.zip -c :en "acdc" "Angus Young"
| ...
| [py26] [git:dp15] ~/bbot/ % python
| Python 2.6.4 (r264:75706, Oct 27 2009, 06:25:13)
| [GCC 4.4.1] on linux2
| Type "help", "copyright", "credits" or "license" for more information.
| >>> from mwlib.wiki import makewiki
| >>> w=makewiki("acdc.zip").wiki
| reading /tmp/tmpnGvhUD/revisions-1.txt
| >>> a=w.getParsedArticle("Acdc")
| >>> a.children
| [TagNode tagname='div' vlist={u'class': u'dablink'}->'div', Paragraph
tagname='p'->'p', Table tagname='table' vlist={'style': {u'width': u'22em',
u'font-size': u'88%', u'line-height': u'1.5em', u'text-align': u'left'},
u'class': u'infobox vcard'}, Paragraph tagname='p'->'p', Paragraph
tagname='p'->'p', Paragraph tagname='p'->'p', Paragraph tagname='p'->'p',
Section tagname='@section' level=2, Section tagname='@section' level=3, Section
tagname='@section' level=3, Section tagname='@section' level=4, Section
tagname='@section' level=4, Section tagname='@section' level=3, Section
tagname='@section' level=4, Section tagname='@section' level=4, Section
tagname='@section' level=4, Section tagname='@section' level=4, Section
tagname='@section' level=4, Section tagname='@section' level=2, Section
tagname='@section' level=2, Section tagname='@section' level=2, Section
tagname='@section' level=2, Section tagname='@section' level=2, Section
tagname='@section' level=2, Section tagname='@section' level=2, Section
tagname='@section' level=2]
| ...
`----
> pass in some raw text w/template information and get a fully processed
> parse tree with template expansion?
grep for DictDB to find a minimal wikidb implementation that works for
parsing articles. it wouldn't work for rendering articles though.
>
> 2. Even after looking through the code, I'm having trouble figuring
> out what kind of API the nuwiki module is representing. Unfortunately,
> the documentation at http://code.pediapress.com/wiki/wiki/VirtualWiki
> seemed very old and unhelpful. Can anyone help shine some light on
> this?
yes, someone should fork mwlib and write proper documentation. sorry,
but I don't see that situation improving anytime soon. you'll have to
dig through the code..
>
> 3. In the case that I setup a cdbwiki, will I require a full MediaWiki
> setup or is there a bare minimum requirement on how the database can
> be setup.
cdbwikis are normally created by mw-buildcdb, which read an xml
dump. you don't need a working mediawiki setup.
--
You received this message because you are subscribed to the Google Groups
"mwlib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/mwlib?hl=en.