-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Karen Coombs
committed
Sep 15, 2023
1 parent
22af125
commit 4935450
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"longname": "Digitalia", | ||
"name": "dgt", | ||
"describe": "Recognizes the accesses to the platform Digitalia", | ||
"contact": "Ghislaine Crespy-Faure, Sean Duffy", | ||
"pkb": false, | ||
"docurl": "http://analyses.ezpaarse.org/platforms/565d715d74bd5ac15be36ab8", | ||
"domains": [ | ||
"www.digitaliapublishing.com" | ||
], | ||
"version": "2023-09-15", | ||
"status": "beta" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
const Parser = require('../.lib/parser.js'); | ||
|
||
/** | ||
* Recognizes the accesses to the platform Digitalia | ||
* @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; | ||
// uncomment this line if you need parameters | ||
let param = parsedUrl.query || {}; | ||
|
||
// use console.error for debuging | ||
// console.error(parsedUrl); | ||
|
||
let match; | ||
|
||
if ((match = /^\/a\/([0-9]+)\/([a-z0-9-]+)$/i.exec(path)) !== null) { | ||
// https://www.digitaliapublishing.com/a/85727/la-hendidura-de-la-roca | ||
// https://www.digitaliapublishing.com/a/54993/agronomia-costarricense--volumen-40--numero-1 | ||
result.rtype = 'RECORD'; | ||
result.mime = 'HTML'; | ||
result.title_id = match[1]; | ||
result.unitid = match[1]; | ||
|
||
} else if (/^\/viewepub\/$/i.test(path)) { | ||
// https://www.digitaliapublishing.com/viewepub/?id=85727 | ||
// https://www.digitaliapublishing.com/viewepub/?id=125550 | ||
result.rtype = 'BOOK'; | ||
result.mime = 'HTML'; | ||
result.title_id = param.id; | ||
result.unitid = param.id; | ||
} else if (/^\/fulltext$/i.test(path)) { | ||
// https://www.digitaliapublishing.com/fulltext | ||
result.rtype = 'SEARCH'; | ||
result.mime = 'HTML'; | ||
} | ||
|
||
return result; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
out-title_id;out-unitid;out-rtype;out-mime;in-url | ||
85727;85727;RECORD;HTML;https://www.digitaliapublishing.com/a/85727/la-hendidura-de-la-roca | ||
85727;85727;BOOK;HTML;https://www.digitaliapublishing.com/viewepub/?id=85727 | ||
125550;125550;BOOK;HTML;https://www.digitaliapublishing.com/viewepub/?id=125550 | ||
54993;54993;RECORD;HTML;https://www.digitaliapublishing.com/a/54993/agronomia-costarricense--volumen-40--numero-1 | ||
;;SEARCH;HTML;https://www.digitaliapublishing.com/fulltext |