Use the HTTPS version of Scholars Portal books
authorDan Scott <dan@coffeecode.net>
Tue, 7 Apr 2020 17:04:44 +0000 (13:04 -0400)
committerDan Scott <dan@coffeecode.net>
Tue, 7 Apr 2020 17:04:44 +0000 (13:04 -0400)
Signed-off-by: Dan Scott <dan@coffeecode.net>
tools/ebooks/prep_ebook_records.py

index 220a1a2..7786453 100755 (executable)
@@ -1289,6 +1289,12 @@ def get_subfields(field, data, platform):
     subs = []
     url = field["u"]
 
+    # Let's get to HTTPS whenever possible
+    if url.startswith("http://books.scholarsportal.info"):
+        url = url.replace(
+            "http://books.scholarsportal.info", "https://books.scholarsportal.info"
+        )
+
     # Is this an ebrary URL?
     ebrary = False
     if url.find(".ebrary.com") > -1:
@@ -1305,9 +1311,9 @@ def get_subfields(field, data, platform):
         subs.extend(["u", url])
     else:
         if data["ebrary_code"] == "ocls" and re.search(r"ra.ocls.ca", field["u"]):
-            subs.extend(["u", field["u"]])
+            subs.extend(["u", url])
         else:
-            subs.extend(["u", data["proxy"] + field["u"]])
+            subs.extend(["u", data["proxy"] + url])
 
     # Check for a $z as the first 856; in Springer records, at least, this
     # indicates a multi-volume set that requires keeping the $z around