 (defn resolve-doi-from-url
   "Take a URL and try to resolve it to find what valid DOI it corresponds to."
   [url]
-  (info "Try to resolve:" url)
+  (info "Attempt resolve-doi-from-url: " url)
 
   ; Check if we want to bother with this URL.
   

      [:embedded embedded-valid-doi]

    ; Try to treat it as a Publisher URL that must be fetched to extract its DOI.
    (if-let [resolved-valid-doi (resolve-doi-from-url input)]
      [:resolved resolved-valid-doi]
      nil))))


      ; Or try this substring.
      (if-let [clean-doi (resolve-doi-maybe-escaped doi)] 
        ; resolve-doi may alter the DOI it returns, e.g. resolving a shortDOI to a real DOI or lower-casing.
        
        ; We have a working DOI!
        ; Just check it does't contain a sneaky question mark which would still resolve e.g. http://www.tandfonline.com/doi/full/10.1080/00325481.2016.1186487?platform=hootsuite
        ; If there is a question mark, try removing it to see if it still works.
        (if (.contains clean-doi "?")
          (let [before-q (first (.split clean-doi "\\?"))]
            (if (resolve-doi before-q)
              before-q
              clean-doi))
          clean-doi)
        
        (recur (inc i) (.substring doi 0 (- (.length doi) 1)))))))

(defn first-valid
