-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocessIIIF.mjs
executable file
·36 lines (30 loc) · 1.13 KB
/
processIIIF.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import manifesto from 'manifesto.js';
const url = 'https://app.digitale-sammlungen.de/demo/iiif/presentation/v2/collection/kba';
async function getManifestData(manifests) {
try {
const manifestData = manifests.map(async (manifest) => {
const loadManifest = await manifesto.loadManifest(manifest.id);
const parsedManifest = manifesto.parseManifest(loadManifest);
return {
name: manifest.getLabel().getValue(),
source: parsedManifest.getSequenceByIndex(0).getCanvasByIndex(0).getImages()[0].getResource().id,
description: parsedManifest.getDescription().getValue(),
link: parsedManifest.getRelated(),
wiki: manifest.id,
};
});
return await Promise.all(manifestData);
} catch (err) {
console.log(err);
}
}
export async function processIIIFData() {
const manifestResource = await manifesto.loadManifest(url);
const iiifResource = manifesto.parseManifest(manifestResource);
if (iiifResource.isCollection()) {
const manifests = iiifResource.getManifests();
const iiifData = await getManifestData(manifests);
console.log(iiifData);
}
}
processIIIFData();