pull from wiki script

master
bootleglibrary 5 years ago
parent da4b7f3424
commit 3c73736d2e

@ -10,3 +10,7 @@ cd /var/www/html
source venv/bin/activate
## Pulling the tasks
python scripts/pulltasks.py > tasks.html

@ -0,0 +1,40 @@
import argparse
from mwclient import Site
NS_CATEGORY = 14
p = argparse.ArgumentParser(description="Dump wiki files to html")
p.add_argument("--host", metavar='', default="pzwiki.wdka.nl", help='wiki host')
p.add_argument("--path", metavar='', default="/mw-mediadesign/", help="Wiki path. Should end with /")
p.add_argument("--output", default="../", help="Output path for pages")
args = p.parse_args()
print(args)
# site and login
print ("""<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tasks of the Contingent Librarian</title>
<link rel="stylesheet" type="text/css" href="tasks.css">
<script src="tasks.js"></script>
</head>
<body>
""")
site = Site(host=args.host, path=args.path)
tasks=site.Categories['Tasks of the Contingent Librarian']
for card in tasks.members():
print ("<hr>")
print ("<h1>{}</h1>".format(card.page_title))
print ()
# print (card.text())
htmlsrc = site.parse(page=card.name)['text']['*']
print ("""<div class="card">{}</div>""".format(htmlsrc))
print ("""
</body>
</html>""")

@ -0,0 +1,24 @@
import argparse
from mwclient import Site
NS_CATEGORY = 14
p = argparse.ArgumentParser(description="Dump wiki files to html")
p.add_argument("--host", metavar='', default="pzwiki.wdka.nl", help='wiki host')
p.add_argument("--path", metavar='', default="/mw-mediadesign/", help="Wiki path. Should end with /")
p.add_argument("--output", default="../", help="Output path for pages")
args = p.parse_args()
print(args)
# site and login
site = Site(host=args.host, path=args.path)
tasks=site.Categories['Tasks of the Contingent Librarian']
for card in tasks.members():
print ("<hr>")
print ("<h1>{}</h1>".format(card.page_title))
print ()
# print (card.text())
htmlsrc = site.parse(page=card.name)['text']['*']
print ("""<div class="card">{}</div>""".format(htmlsrc))
Loading…
Cancel
Save