You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
489 B
Python
20 lines
489 B
Python
import io
|
|
import requests
|
|
import getpass
|
|
from lxml import html
|
|
|
|
# Get login details
|
|
username = input('Username: ')
|
|
password = getpass.getpass('Password: ')
|
|
|
|
# Get list of all pages
|
|
url = 'http://wiki.wrl.unsw.edu.au/index.php'
|
|
page = requests.get(url + '/Special:Allpages', auth=(username, password))
|
|
tree = html.parse(io.BytesIO(page.content))
|
|
|
|
# Save page names
|
|
elements = tree.xpath('*//td/a')[1:]
|
|
with open('pages.txt', 'w') as f:
|
|
for e in elements:
|
|
f.write(e.text + '\n')
|