Compare commits
1 Commits
master
...
populat_or
Author | SHA1 | Date |
---|---|---|
Castro0o | 401f6b8036 | 5 years ago |
@ -0,0 +1,28 @@
|
||||
import os, argparse, sys, re, json
|
||||
from mwclient import (Site,
|
||||
errors)
|
||||
|
||||
# API CALL
|
||||
# https://hub.xpub.nl/sandbox/itchwiki/api.php?action=smwbrowse&browse=pvalue¶ms={ "limit": 1500, "offset": 0, "property" : "Organization", "search": "" }&format=json
|
||||
# generated orgs.json
|
||||
|
||||
# login
|
||||
site = Site(host='hub.xpub.nl/sandbox', path='/itchwiki/')
|
||||
|
||||
wd =os.path.dirname(os.path.abspath(__file__)) # parent working directory
|
||||
with open(os.path.join(wd, 'login.txt'), 'r') as login: # read login user & pwd
|
||||
loginlines = login.read()
|
||||
user, pwd = loginlines.split('\n')
|
||||
site.login(username=user, password=pwd) # login to wiki
|
||||
|
||||
|
||||
with open('orgs.json', 'r') as f:
|
||||
orgs = json.load(f)
|
||||
|
||||
for pagename in orgs['query']:
|
||||
if pagename != 'League of Filipino Students (LFS)':
|
||||
# print(pagename)
|
||||
page = site.pages[pagename]
|
||||
print(page)
|
||||
# text = page.text()
|
||||
page.save('[[Category:Organization]]')
|
Loading…
Reference in New Issue