From 83f72db6cd03ab3d80105b3145185a53e3443992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20Popp=20N=C3=B8rskov?= Date: Sat, 20 Apr 2019 22:42:09 +0200 Subject: [PATCH] Wikiapiary update script - Change Internet Archive search string to search using both API URL and Index URL. --- wikiapiary/wikiapiary-update-ia-params.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wikiapiary/wikiapiary-update-ia-params.py b/wikiapiary/wikiapiary-update-ia-params.py index 0b20de0..f5ac188 100644 --- a/wikiapiary/wikiapiary-update-ia-params.py +++ b/wikiapiary/wikiapiary-update-ia-params.py @@ -52,7 +52,8 @@ def main(): print('No API found in WikiApiary, skiping') continue - urliasearch = 'https://archive.org/search.php?query=originalurl:"%s"' % (apiurl) + indexurl = 'index.php'.join(apiurl.rsplit('api.php', 1)) + urliasearch = 'https://archive.org/search.php?query=originalurl:"%s" OR originalurl:"%s"' % (apiurl, indexurl) f = urllib.request.urlopen(urliasearch) raw = f.read().decode('utf-8') if re.search(r'(?i)Your search did not match any items', raw):