Giter Site home page Giter Site logo

rchrd2 / iajs Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 5.0 2.23 MB

Internet Archive JavaScript Client which supports reading and writing data in NodeJS and the Browser

License: MIT License

JavaScript 100.00%
internet-archive archive-org wayback-machine wayback gificites api-client sdk metadata s3 upload

iajs's Introduction

iajs

Internet Archive JavaScript Client which supports reading and writing data in NodeJS and the Browser

The Internet Archive is a non-profit open platform for archiving the world's free websites, books, movies, software, music, and more.

This JavaScript library enables reading and writing to the Internet Archive APIs in NodeJS and in the browser. To learn more about the Internet Archive visit https://archive.org/about/.

It's lightweight with very little dependencies.

The major APIs are documented here https://archive.org/services/docs/api/index.html, but this library supports additional APIs to enable more functionality. It does not abstract much from the APIs, but rather aggregates access to them all in a single multi-purpose library.

This library contains enough functionality to create powerful experiments and new experiences using the Internet Archive's platform and data.

Installation

Through npm

npm i iajs

Load from CDN in browser

<script src="https://unpkg.com/iajs/dist/ia.browser.js"></script>

Live demos

https://rchrd2.github.io/iajs/examples/web/01.html

Usage Examples

<script src="https://unpkg.com/iajs/dist/ia.browser.js"></script>
<script>
ia.GifcitiesAPI.search("snowglobe").then(console.log);

ia.MetadataAPI.get({
  identifier: "mma_the_sphynx_and_great_pyramid_geezeh_271101",
}).then(console.log);

ia.SearchAPI.get({
  q: {collection: "metropolitanmuseumofart-gallery"},
  fields: ["identifier", "title"]
}).then(console.log);
</script>

Running NodeJS examples

npm i
node examples/node/01-hello.js

# this will ask you to sign in and create a login config file for other examples
node examples/node/02-login.js

node examples/node/03-reviews.js

# and so on...

Planned features

  • ✅ Read item metadata and list of files (Metadata API)
  • ✅ Update item metadata (Metadata API)
  • ✅ Search (Search API)
  • ✅ Search gifcities.org (GifCities API)
  • ✅ Query related item API (Related Items API)
  • ✅ Sign in with user/pass (Xauthn API)
  • ✅ Sign in with s3 tokens
  • ✅ Sign in from archive.org session cookies
  • ✅ Add reviews (Reviews API)
  • ✅ Add page to Wayback (Save Page Now API)
  • ✅ Query the Wayback Machine (CDX and Available APIs)
  • ✅ Add/remove/list favorites (bookmarks.php API)
  • ✅ Create items (S3 API)
  • ✅ Upload item files (S3 API)
  • OpenLibrary.org APIs
  • BookReaderJSIA aka manifest API
  • Book IIIF API
  • TV
  • Radio
  • List reviews by user
  • Generate embed codes for books/videos/music files in item
  • Include a JSON diff library
  • more tbd

Misc

Note: I wanted to build this while I worked at Internet Archive, but did not have the bandwidth. Now I'm working on this in my free time.

See Also:


Screenshot of web usage example

screenshot

iajs's People

Contributors

cclauss avatar rchrd2 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

iajs's Issues

node-fetch "title is not a legal HTTP header value" error

I have this error when PUT meta title with string unicode (utf-8) with iajs

{
'x-archive-meta0-identifier': 'truyen112313docadasdh-dep-zaai-1-1-1-1',
'x-archive-meta0-title': 'Đây là bài viết thử nghiệm', // this is error unicode
'x-archive-meta0-addeddate': '2022-12-13',
'x-archive-meta0-date': '2022-12-13',
'x-archive-meta0-publicdate': '2022-12-13',
'x-archive-meta0-creator': 'https://truyendocviet.com',
'x-archive-meta0-publisher': 'https://truyendocviet.com',
'x-archive-meta0-licenseurl': 'https://truyendocviet.com',
'x-archive-meta0-language': 'Vietnamese',
'x-archive-meta0-mediatype': 'audio',
'Content-Type': 'application/json; charset=utf-8',
Authorization: 'LOW xxx:xxx'
}

How to upload file (.mp4) ?

Where to fill the file in the option. it usually inside the { form : { file: "/file" } } .
Also how can I fetch the authentication header ? why is it empty ?

This part code is from your module file /dist/ia.cjs.js
const newEmptyAuth = function() { return JSON.parse( JSON.stringify({ success: false, values: { cookies: { "logged-in-sig": null, "logged-in-user": null }, email: null, itemname: null, s3: { access: null, secret: null }, screenname: null, }, version: 1, }) ); };

I want to upload file with the below
await S3API.upload({ identifier, key, body: 'upload at ' + date, path, metadata, autocreate: true, auth, })

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.