-
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.
Merge pull request #752 from OCLC-Developer-Network/hapi
Added parser for Hispanic American Periodicals
- Loading branch information
Showing
3 changed files
with
59 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": "Hispanic American Periodicals", | ||
"name": "hapi", | ||
"describe": "Recognizes the accesses to the platform Hispanic American Periodicals", | ||
"contact": "Violita Kovchegov", | ||
"pkb": false, | ||
"docurl": "http://analyses.ezpaarse.org/platforms/64f8b318d77a71c949527f9b", | ||
"domains": [ | ||
"hapi.ucla.edu" | ||
], | ||
"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,42 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
const Parser = require('../.lib/parser.js'); | ||
|
||
/** | ||
* Recognizes the accesses to the platform Hispanic American Periodicals | ||
* @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 = /^\/article\/citation\/([0-9]+)$/i.exec(path)) !== null) { | ||
// https://hapi.ucla.edu/article/citation/378232 | ||
result.rtype = 'RECORD_VIEW'; | ||
result.mime = 'HTML'; | ||
result.unitid = match[1]; | ||
|
||
} else if ((match = /^\/article\/frame\/([0-9]+)\/([0-9]+)$/i.exec(path)) !== null) { | ||
// https://hapi.ucla.edu/article/frame/378288/1315 | ||
result.rtype = 'TOC'; | ||
result.mime = 'HTML'; | ||
result.unitid = match[2]; | ||
} else if (/^\/search\/advanced$/i.test(path)) { | ||
// https://hapi.ucla.edu/search/advanced | ||
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,4 @@ | ||
out-unitid;out-rtype;out-mime;in-url | ||
378232;RECORD_VIEW;HTML;https://hapi.ucla.edu/article/citation/378232 | ||
1315;TOC;HTML;https://hapi.ucla.edu/article/frame/378288/1315 | ||
;SEARCH;HTML;https://hapi.ucla.edu/search/advanced |