|
|
|
@ -43,6 +43,7 @@ site = mwsite(args.host, args.path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
query= ('[[File:+]]'+ args.ask)
|
|
|
|
|
print 'Query:', query
|
|
|
|
|
|
|
|
|
|
# examples:
|
|
|
|
|
# [[File:+]][[Year::+]][[Document_Type::Poster]]
|
|
|
|
@ -57,6 +58,7 @@ for answer in site.ask(query):
|
|
|
|
|
img_page_url = answer[img_key]['fullurl']
|
|
|
|
|
img = image.Image(site, answer)
|
|
|
|
|
img_info = img.imageinfo # dict includes url and extensive metadata
|
|
|
|
|
print img_name
|
|
|
|
|
# FILE DOWNLOAD
|
|
|
|
|
if 'url' in img_info.keys() and len(args.download) > 0:
|
|
|
|
|
img_url = (img_info['url']).replace('https','http')
|
|
|
|
@ -75,7 +77,6 @@ for answer in site.ask(query):
|
|
|
|
|
download_path = args.download
|
|
|
|
|
print u'Saved to {}'.format(download_path + img_name)
|
|
|
|
|
if args.verbose:
|
|
|
|
|
print 'File text:',img_text
|
|
|
|
|
pprint.pprint( img_info )
|
|
|
|
|
|
|
|
|
|
print
|
|
|
|
|