Giter Club home page Giter Club logo

memento-client's Introduction

memento-client

Build Status npm install npm version js-standard-style License

simple interface to memento services

usage

var memento = require('memento-client')

memento(url, listAll)

function listAll (err, mementos) {
  console.log(mementos) // [{href: url, rel: identifier, datetime: timestamp}]
}

// provide an options object with time to narrow your search!
memento(url, {time: '2010'}, list2010)

function list2010 (err, mementos) {
  console.log(mementos) // all found from 2010
}

// also optionally provide your own host's timemap! (defaults to the wayback machine)

memento(url, {host: 'http://some-other-memento-provider/timemap'}, getCustom)

function getCustom (err, mementos) {
  // ta-da!
}

notes

  • identifier is one of: first memento, prev memento, next memento, memento, or last memento.
  • finds nearest available memento for url to opts.time
  • opts.time can be any reasonable approximation of a datetime and it should Just Work(tm)
  • filters out non-mementos from response (timegate and original url)
  • first and last entries in response will always be the first and last mementos available.

license

MIT

memento-client's People

Contributors

bergie avatar jarofghosts avatar komachi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

memento-client's Issues

Support comprehensive list of mementos

It's nice to see this module exists for node.

I would like to be able to get a comprehensive list of all mementos for a URI, not just those that resolve when I send the Accept-Datetime HTTP header. This can be accomplished by querying a TimeGate to obtain the TimeMap.

One caveat that I have come across, especially when dealing with Memento aggregators, is paginated TimeMaps. The facility (see § 5.1.1 of RFC7089) allows a large collection of mementos (e.g., from cnn.com) to be spread across multiple TimeMaps.

Error when using from Electron

I just tried to use this from an Electron app, and got this error. Any ideas?

TypeError: value.charAt is not a function
    at skipSpaces (/Users/andy/Documents/workspace/ukwa-player/node_modules/http-link/main.js:18:55)
    at httpLink.parse (/Users/andy/Documents/workspace/ukwa-player/node_modules/http-link/main.js:130:15)
    at parseLinks (/Users/andy/Documents/workspace/ukwa-player/node_modules/memento-client/index.js:68:18)
    at ConcatStream.<anonymous> (/Users/andy/Documents/workspace/ukwa-player/node_modules/concat-stream/index.js:36:43)
    at emitNone (events.js:91:20)
    at ConcatStream.emit (events.js:185:7)
    at finishMaybe (/Users/andy/Documents/workspace/ukwa-player/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:607:14)
    at endWritable (/Users/andy/Documents/workspace/ukwa-player/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:615:3)
    at ConcatStream.Writable.end (/Users/andy/Documents/workspace/ukwa-player/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:571:41)
    at IncomingMessage.onend (_stream_readable.js:511:10)

http-link throws exceptions

In some cases, like page not existing in Wayback Machine, memento-client ends up throwing exceptions because http-link does so.

The places where http-link is called should be wrapped in try/catch

Isn't working: CORS issue

I'm trying to use your package, however I keep getting the following erro:

Fetch API cannot load http://web.archive.org/web/timemap/link/{my-url}. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://local.wordpress-trunk.dev' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Any suggestions?

Parameterize destination of query

Internet Archive's interface looks to be hard-coded but there are quite a few other Memento-compliant web archives. Parameterizing the destination of the request for mementos would make your module more useful (maybe with a fallback to IA's Wayback).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.