ukwa / ukwa-gsheets-utils

Add-On for Google Sheets to help those working with web archives.
Apache License 2.0
6 stars 3 forks source link

Add function to return date of most recent UKWA capture of a URL #3

Open anjackson opened 5 years ago

anjackson commented 5 years ago

Our curators have suggested that a function that returns the most recent crawl date (rather than the crawl status) would be useful. e.g.

=WEBARCHIVE_LAST_MEMENTO_DATE_UKWA({url})
machawk1 commented 5 years ago
  const headers = response.getHeaders()
  if ('memento-datetime' in headers) {
    return headers['memento-datetime']
  } else {
      return ""
  }

...as the final line of the new function should accomplish this. It could also be pared down to a more succinct, less expressive form. Also, you may need to adapt to Memento-Datetime capitalization per-archive. UKWA appears to use all-lowercase and JS objects are case sensitive.