Skip to content

karpour/internetarchive-ts

Repository files navigation

Internet Archive Typescript API client

This is a work-in-progress verion and not fully functional.

This API is intended to serve as a base for server-, desktop- and web-applications and offers functions to easily fetch, create and update items in the Internet Archive as well as access the full functionality of all APIs offered by archive.org, including the WaybackMachine. The code is partially based on the Internet Archive Python API client and contains all features of the python package, however no cli is included. For an out-of-the-box cli tool, please use the python package.

Features

  • Strongly typed methods
  • Fully documented with examples
  • Fine-grained error handling
  • Convenience functions
  • Works both in node.js and browsers
  • 100% unit tested (WIP)
  • Integration tests (WIP)

Strong typing

Strong types are used to enable a good developer experience. Return types are dependent on the input, for example when fields to return are supplied.

Example:

const result = await waybackMachine.getSnapshotMatches("https://twitter.com/internetarchive/", {
    limit: 10
});
const digest = matches[0].digest; // OK
const result = await waybackMachine.getSnapshotMatches("https://twitter.com/internetarchive/", {
    fl: ["urlkey", "mimetype", "statuscode", "timestamp"],
    limit: 10
});
const digest = matches[0].digest;
// Property 'digest' does not exist on type '{ urlkey: string; timestamp: string; mimetype: string; statuscode: string; }'

Documentation

The API docs are located here.

Credentials

This API uses S3 API credentials for authentication. You can obtain them here

Examples

Example .ts files are located in src/examples

Get item

const item = await getItem('nasa');
    
console.log(`Identifier: ${item.identifier}`);
console.log(`Item size: ${item.item_size}`);
console.log(`Date: ${item.created}`);

Unit tests

npm run test:unit

Referenced Documentation

Dependencies

About

Internet Archive Typescript client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published