Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qvint/archive.is
[ABANDONED] Unofficial Node.js API for archive.is
https://github.com/qvint/archive.is
Last synced: about 1 month ago
JSON representation
[ABANDONED] Unofficial Node.js API for archive.is
- Host: GitHub
- URL: https://github.com/qvint/archive.is
- Owner: qvint
- License: gpl-3.0
- Created: 2016-01-27T14:01:27.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-28T16:14:44.000Z (almost 9 years ago)
- Last Synced: 2024-04-26T08:04:12.595Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 16
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-memento - src - Memento-based API for [archive.is](http://archive.is/) in JavaScript (Software / Command-line Clients)
README
# archive.is
Unofficial Node.js API for [archive.is][1]
[![Build Status](https://travis-ci.org/qvint/archive.is.svg?branch=master)](https://travis-ci.org/qvint/archive.is)
[![Dependency Status](https://david-dm.org/qvint/archive.is.svg)](https://david-dm.org/qvint/archive.is)
[![devDependency Status](https://david-dm.org/qvint/archive.is/dev-status.svg)](https://david-dm.org/qvint/archive.is#info=devDependencies)## Install
```bash
npm install archive.is --save
```## Usage
```js
var archive = require('archive.is');// Get the last existing snapshot of https://www.kernel.org
archive.timemap('https://www.kernel.org').then(function (timemap) {
console.log(timemap.last);
// { url: 'https://archive.is/20160109153444/https://www.kernel.org/',
// date: Sat, 09 Jan 2016 15:34:44 GMT }
});// Take a new snapshot of https://www.kernel.org
archive.save('https://www.kernel.org').then(function (result) {
console.log(result.shortUrl); // https://archive.is/EJoGi
});
```## API
### `timemap(url, [callback])`
Get a list of all snapshots of a given page.
* **`url`** `{string}` Page URL
* **`callback`** `{function}` If omitted, a promise will be returnedReturned promise will be fulfilled with an object with the following keys:
* **`original`** `{string}` Original page URL
* **`timegate`** `{string}` Timegate URL
* **`first`**{[Memento][3]}
The oldest snapshot
* **`last`**{[Memento][3]}
The newest snapshot
* **`mementos`**{Array.<[Memento][3]>}
All snapshots sorted by `date` in ascending orderExample result:
```
{ original: 'https://www.kernel.org/',
timegate: 'https://archive.is/timegate/https://www.kernel.org/',
first:
{ url: 'https://archive.is/19980130085039/http://www.kernel.org/',
date: Fri, 30 Jan 1998 08:50:39 GMT },
last:
{ url: 'https://archive.is/20160127210011/https://www.kernel.org/',
date: Wed, 27 Jan 2016 21:00:11 GMT } }
mementos:
[ { url: 'https://archive.is/19980130085039/http://www.kernel.org/',
date: Fri, 30 Jan 1998 08:50:39 GMT },
{ url: 'https://archive.is/19990429093120/http://www.kernel.org/',
date:Thu, 29 Apr 1999 09:31:20 GMT },
...
{ url: 'https://archive.is/20160127180405/https://www.kernel.org/',
date: Wed, 27 Jan 2016 18:04:05 GMT },
{ url: 'https://archive.is/20160127210011/https://www.kernel.org/',
date: Wed, 27 Jan 2016 21:00:11 GMT } ]
```### `save(url, [options], [callback])`
Take a new snapshot of a page.
* **`url`** `{string}` Page URL
* **`options`** `{Object}`
* **`options.anyway`** `{boolean}` Force snapshot taking, even if it already exists `[false]`
* **`callback`** `{function}` If omitted, a promise will be returnedReturned promise will be fulfilled with an object with the following keys:
* **`id`** `{string}` Snapshot ID
* **`shortUrl`** `{string}` Short URL (https://archive.is/ + id)
* **`alreadyExists`** `{boolean}` Shows if the returned snapshot was newly created (false) or not (true)Note that `anyway` option cannot be used more than once in ~3–5 minutes for the same URL. So it is possible to get already existing snapshot, even after setting `anyway` to true.
Example result:
```
{ id: 'nUdVJ',
shortUrl: 'https://archive.is/nUdVJ',
alreadyExists: true }
```* **`url`** `{string}` Snapshot access URL
* **`date`** `{Date}` Snapshot taking date## License
The `archive.is` package is released under the GPL-3.0 license. See the [LICENSE][2] for more information.
[1]: https://archive.is
[2]: https://github.com/qvint/archive.is/blob/master/LICENSE
[3]: #memento