Skip to content

Commit

Permalink
Adds parser for Index of Medieval Art [indexmedievalart]
Browse files Browse the repository at this point in the history
  • Loading branch information
AGCooper committed Nov 26, 2019
1 parent 9c536ff commit 4093b2d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
14 changes: 14 additions & 0 deletions indexmedievalart/manifest.json
@@ -0,0 +1,14 @@
{
"longname": "Index of Medieval Art",
"name": "indexmedievalart",
"describe": "Recognizes the accesses to the platform Index of Medieval Art",
"contact": "acoope5@emory.edu",
"pkb": false,
"docurl": "http://ang.couperin.org/platforms/5dddb07760f0a443f0e7007e",
"domains": [
"theindex.princeton.edu",
"www.theindex.princeton.edu"
],
"version": "2019-10-01",
"status": "active"
}
40 changes: 40 additions & 0 deletions indexmedievalart/parser.js
@@ -0,0 +1,40 @@
#!/usr/bin/env node

'use strict';
const Parser = require('../.lib/parser.js');

/**
* Recognizes the accesses to the platform Index of Medieval Art
* @param {Object} parsedUrl an object representing the URL to analyze
* main attributes: pathname, query, hostname
* @param {Object} ec an object representing the EC whose URL is being analyzed
* @return {Object} the result
*/
module.exports = new Parser(function analyseEC(parsedUrl, ec) {
let result = {};
let path = parsedUrl.pathname;
let param = parsedUrl.query || {};

// let match;

if (/^\/([a-z])\/view\/View([a-zA-Z0-9]+).action?$/i.test(path)) {
// https://theindex.princeton.edu:443/s/view/ViewLanguage.action?id=54F4F8DA-5A9E-426E-A7EB-5ADB7F2DE9DA
// https://theindex.princeton.edu:443/s/view/ViewExternalReference.action?id=1EF3907B-BE7B-413E-9225-3DB764707EEC
// https://theindex.princeton.edu:443/s/view/ViewExternalReferenceSource.action?id=89F634C8-75A3-4E73-B271-1654C633FD45
// https://theindex.princeton.edu:443/s/view/ViewWorkOfArt.action?id=E512F406-A94C-4D7C-9611-165AA4054DA5
// https://theindex.princeton.edu:443/s/view/ViewIllustrationType.action?id=D566D8A8-D87D-4696-A0A2-3F974F98501A
// https://theindex.princeton.edu:443/s/view/ViewLocation.action?id=30FAC388-6F0B-45D4-8381-37A1CF94AC75
result.rtype = 'REF';
result.mime = 'HTML';
result.unitid = param.id;

} else if ((/^\/([a-z])\/(Search|Browse)([a-zA-Z0-9]+).action?$/i.exec(path)) || (/^\/([a-z])\/list\/List([a-zA-Z0-9]+).action?$/i.test(path))) {
// https://theindex.princeton.edu:443/s/SearchWorksOfArt.action
// https://theindex.princeton.edu:443/s/BrowseSubjectClassifications.action
// https://theindex.princeton.edu:443/s/list/ListLanguages.action
result.rtype = 'SEARCH';
result.mime = 'MISC';
}

return result;
});
10 changes: 10 additions & 0 deletions indexmedievalart/test/indexmedievalart.2019-10-01.csv
@@ -0,0 +1,10 @@
out-unitid;out-rtype;out-mime;in-url
;SEARCH;MISC;https://theindex.princeton.edu:443/s/SearchWorksOfArt.action
;SEARCH;MISC;https://theindex.princeton.edu:443/s/BrowseSubjectClassifications.action
;SEARCH;MISC;https://theindex.princeton.edu:443/s/list/ListLanguages.action
54F4F8DA-5A9E-426E-A7EB-5ADB7F2DE9DA;REF;HTML;https://theindex.princeton.edu:443/s/view/ViewLanguage.action?id=54F4F8DA-5A9E-426E-A7EB-5ADB7F2DE9DA
1EF3907B-BE7B-413E-9225-3DB764707EEC;REF;HTML;https://theindex.princeton.edu:443/s/view/ViewExternalReference.action?id=1EF3907B-BE7B-413E-9225-3DB764707EEC
89F634C8-75A3-4E73-B271-1654C633FD45;REF;HTML;https://theindex.princeton.edu:443/s/view/ViewExternalReferenceSource.action?id=89F634C8-75A3-4E73-B271-1654C633FD45
E512F406-A94C-4D7C-9611-165AA4054DA5;REF;HTML;https://theindex.princeton.edu:443/s/view/ViewWorkOfArt.action?id=E512F406-A94C-4D7C-9611-165AA4054DA5
D566D8A8-D87D-4696-A0A2-3F974F98501A;REF;HTML;https://theindex.princeton.edu:443/s/view/ViewIllustrationType.action?id=D566D8A8-D87D-4696-A0A2-3F974F98501A
30FAC388-6F0B-45D4-8381-37A1CF94AC75;REF;HTML;https://theindex.princeton.edu:443/s/view/ViewLocation.action?id=30FAC388-6F0B-45D4-8381-37A1CF94AC75

0 comments on commit 4093b2d

Please sign in to comment.