Skip to content

Commit

Permalink
Merge pull request #874 from ezpaarse-project:feature/ebsco25
Browse files Browse the repository at this point in the history
feat(ebsco25): added support for new version of ebscohost
  • Loading branch information
nojhamster authored Feb 12, 2025
2 parents bd8c6a2 + 7076339 commit 724ae64
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ebsco25/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"longname": "Ebsco Host 2025",
"name": "ebsco25",
"describe": "Recognizes the accesses to the platform Ebsco Host 2025",
"contact": "Frederic Truong inist",
"pkb": false,
"docurl": "https://analyses.ezpaarse.org/platforms/632b48ac2cde73015cd63cd3",
"domains": [
"research.ebsco.com",
"viewer.ebscohost.com"
],
"version": "2025-02-11",
"status": "beta"
}
61 changes: 61 additions & 0 deletions ebsco25/parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env node

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

/**
* Recognizes the accesses to the platform Ebsco Host 2025
* @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 ((match = /^\/api\/search\/v[0-9]+\/search$/i.exec(path)) !== null) {
// /api/search/v1/search?applyAllLimiters=true&includeSavedItems=false
result.rtype = 'SEARCH';
result.mime = 'HTML';
} else if ((match = /^\/c\/[a-z0-9]+\/search\/details\/([a-z0-9]+)$/i.exec(path)) !== null) {
// /c/dgznfn/search/details/w2sj2vnexn?db=asn&isDashboardExpanded=false&limiters=None&q=brain
// /c/kczqeg/search/details/seiqme3mwr?db=kah%2Cmlf&isDashboardExpanded=false&limiters=None&q=A14
// /c/cp44gr/search/details/nsywpxxlmv?db=nlebk
result.rtype = 'RECORD';
result.mime = 'HTML';
result.unitid = match[1];
result.db_id = param.db;
} else if ((match = /^\/api\/search\/v[0-9]+\/details$/i.exec(path)) !== null) {
// /api/search/v2/details?recordId=w2sj2vnexn&profileIdentifier=dgznfn
result.rtype = 'RECORD';
result.mime = 'HTML';
result.unitid = param.recordId;
} else if ((match = /^\/c\/[a-z0-9]+\/viewer\/(pdf|html)\/([a-z0-9]+)$/i.exec(path)) !== null) {
// /c/dgznfn/viewer/pdf/w2sj2vnexn
// /c/kczqeg/viewer/pdf/zcsn4yhmbv
// /c/kczqeg/viewer/html/zcsn4yhmbv
result.rtype = 'ARTICLE';
result.mime = match[1].toUpperCase();
result.unitid = match[2];
result.db_id = param.db;
} else if ((match = /^\/api\/viewer\/v[0-9]+\/(details|htmlfulltext)\/([a-z0-9]+)$/i.exec(path)) !== null) {
// /api/viewer/v5/details/w2sj2vnexn?opid=dgznfn
// /api/viewer/v6/htmlfulltext/w2sj2vnexn?opid=dgznfn
result.rtype = 'ARTICLE';
result.mime = match[1] === 'htmlfulltext' ? 'HTML' : 'PDF';
result.unitid = match[2];
} else if ((match = /^\/EbscoViewerService\/ebook$/i.exec(path)) !== null) {
// /EbscoViewerService/ebook?an=157704&callbackUrl=https%3a%2f%2fresearch.ebsco.com&db=nlebk&format=EK&profId=eds&lpid=&ppid=&lang=fr&location=https%3a%2f%2fresearch-ebsco-com.ezproxy.unilim.fr%2fc%2fcp44gr%2fsearch%2fdetails%2fnsywpxxlmv%3fdb%3dnlebk&isPLink=False&requestContext=&profileIdentifier=cp44gr&recordId=nsywpxxlmv
// /EbscoViewerService/ebook?an=157704&callbackUrl=https%3a%2f%2fresearch.ebsco.com&db=nlebk&format=EB&profId=eds&lpid=&ppid=&lang=fr&location=https%3a%2f%2fresearch-ebsco-com.ezproxy.unilim.fr%2fc%2fcp44gr%2fsearch%2fdetails%2fnsywpxxlmv%3fdb%3dnlebk&isPLink=False&requestContext=&profileIdentifier=cp44gr&recordId=nsywpxxlmv
result.rtype = 'BOOK';
result.mime = param.format === 'EB' ? 'PDF' : 'HTML';
result.unitid = param.recordId;
result.db_id = param.db;
}

return result;
});
11 changes: 11 additions & 0 deletions ebsco25/test/Ebsco.2025-02-11.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
out-db_id;out-unitid;out-rtype;out-mime;in-url
;;SEARCH;HTML;https://research-ebsco-com.inee.bib.cnrs.fr/api/search/v1/search?applyAllLimiters=true&includeSavedItems=false
;w2sj2vnexn;RECORD;HTML;https://research-ebsco-com.inee.bib.cnrs.fr/api/search/v2/details?recordId=w2sj2vnexn&profileIdentifier=dgznfn
;w2sj2vnexn;ARTICLE;PDF;https://research-ebsco-com.inee.bib.cnrs.fr/api/viewer/v5/details/w2sj2vnexn?opid=dgznfn
kah,mlf;seiqme3mwr;RECORD;HTML;https://research.ebsco.com/c/kczqeg/search/details/seiqme3mwr?db=kah%2Cmlf&isDashboardExpanded=false&limiters=None&q=A14
;zcsn4yhmbv;ARTICLE;HTML;https://research-ebsco-com.ezproxy.unilim.fr/c/kczqeg/viewer/html/zcsn4yhmbv
;zcsn4yhmbv;ARTICLE;PDF;https://research-ebsco-com.ezproxy.unilim.fr/c/kczqeg/viewer/pdf/zcsn4yhmbv
nlebk;nsywpxxlmv;RECORD;HTML;https://research-ebsco-com.ezproxy.unilim.fr/c/cp44gr/search/details/nsywpxxlmv?db=nlebk
nlebk;nsywpxxlmv;BOOK;HTML;https://viewer-ebscohost-com.ezproxy.unilim.fr/EbscoViewerService/ebook?an=157704&callbackUrl=https%3a%2f%2fresearch.ebsco.com&db=nlebk&format=EK&profId=eds&lpid=&ppid=&lang=fr&location=https%3a%2f%2fresearch-ebsco-com.ezproxy.unilim.fr%2fc%2fcp44gr%2fsearch%2fdetails%2fnsywpxxlmv%3fdb%3dnlebk&isPLink=False&requestContext=&profileIdentifier=cp44gr&recordId=nsywpxxlmv
nlebk;nsywpxxlmv;BOOK;PDF;https://viewer-ebscohost-com.ezproxy.unilim.fr/EbscoViewerService/ebook?an=157704&callbackUrl=https%3a%2f%2fresearch.ebsco.com&db=nlebk&format=EB&profId=eds&lpid=&ppid=&lang=fr&location=https%3a%2f%2fresearch-ebsco-com.ezproxy.unilim.fr%2fc%2fcp44gr%2fsearch%2fdetails%2fnsywpxxlmv%3fdb%3dnlebk&isPLink=False&requestContext=&profileIdentifier=cp44gr&recordId=nsywpxxlmv
;w2sj2vnexn;ARTICLE;HTML;https://research-ebsco-com.inee.bib.cnrs.fr/api/viewer/v6/htmlfulltext/w2sj2vnexn?opid=dgznfn

0 comments on commit 724ae64

Please sign in to comment.