From c25998bf12c5dd0e0866886fed54a95a2153e48b Mon Sep 17 00:00:00 2001 From: Tao Lin <831611+mirguest@users.noreply.github.com> Date: Thu, 23 Jul 2020 05:54:36 +0800 Subject: Support private mediawiki (#1) * add relative path support. * add username and password support. Co-authored-by: Cody Logan --- wikiget/dl.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'wikiget/dl.py') diff --git a/wikiget/dl.py b/wikiget/dl.py index 972058d..c7e593f 100644 --- a/wikiget/dl.py +++ b/wikiget/dl.py @@ -45,10 +45,10 @@ def download(dl, args): site_match = valid_site(site_name) # check for valid site parameter - if not site_match: - print('Only Wikimedia sites (wikipedia.org and wikimedia.org) ' - 'are currently supported.') - sys.exit(1) + # if not site_match: + # print('Only Wikimedia sites (wikipedia.org and wikimedia.org) ' + # 'are currently supported.') + # sys.exit(1) # check if this is a valid file if file_match and file_match.group(1): @@ -68,7 +68,10 @@ def download(dl, args): # connect to site and identify ourselves try: - site = Site(site_name, clients_useragent=USER_AGENT) + print("Site name: {}".format(site_name)) + site = Site(site_name, path=args.path, clients_useragent=USER_AGENT) + if args.username and args.password: + site.login(args.username, args.password) except ConnectionError: # usually this means there is no such site, # or there's no network connection -- cgit v1.2.3