diff --git a/r4l/manifest.json b/r4l/manifest.json new file mode 100644 index 00000000..6b21452b --- /dev/null +++ b/r4l/manifest.json @@ -0,0 +1,14 @@ +{ + "longname": "Research4Life", + "name": "r4l", + "describe": "Recognizes the accesses to the platform Research4Life", + "contact": "Violita Kovchegov", + "pkb": false, + "docurl": "https://analyses.ezpaarse.org/platforms/6750a00a10a95d13398078b5", + "domains": [ + "hinari.summon.serialssolutions.com", + "login.research4life.org" + ], + "version": "2025-01-08", + "status": "beta" +} \ No newline at end of file diff --git a/r4l/parser.js b/r4l/parser.js new file mode 100755 index 00000000..c93ae8b2 --- /dev/null +++ b/r4l/parser.js @@ -0,0 +1,65 @@ +#!/usr/bin/env node + +'use strict'; +const Parser = require('../.lib/parser.js'); + +/** + * Recognizes the accesses to the platform Research4Life + * @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 ((/^\//i.test(path) && parsedUrl.hash != null) || /^\/search\/?/i.test(path)) { + // https://hinari.summon.serialssolutions.com/#!/search?pn=1&ho=t&include.ft.matches=f&l=en&q=food + // https://hinari.summon.serialssolutions.com/#!/search?pn=1&ho=t&include.ft.matches=f&l=en&q=applied%20economics + result.rtype = 'SEARCH'; + result.mime = 'HTML'; + + } else if ((match = /^\/(tacsgr1pubs_acs_org|tacsgr1cdnsciencepub_com)\/doi\/pdf\/([0-9.]+)\/([.A-Za-z0-9-]+)$/i.exec(path)) !== null) { + // https://login.research4life.org/tacsgr1pubs_acs_org/doi/pdf/10.1021/acs.jafc.8b05215 + // https://login.research4life.org/tacsgr1cdnsciencepub_com/doi/pdf/10.1139/apnm-2021-0400 + result.rtype = 'ARTICLE'; + result.mime = 'PDF'; + result.doi = `${match[2]}/${match[3]}`; + result.unitid = `${match[2]}/${match[3]}`; + + } else if ((match = /^\/(tacsgr1pubs_acs_org|tacsgr1cdnsciencepub_com)\/(doi|doi\/full)\/([0-9.]+)\/([.A-Za-z0-9-]+)$/i.exec(path)) !== null) { + // https://login.research4life.org/tacsgr1pubs_acs_org/doi/10.1021/acs.jafc.8b05215 + // https://login.research4life.org/tacsgr1cdnsciencepub_com/doi/full/10.1139/apnm-2021-0400 + result.rtype = 'RECORD'; + result.mime = 'HTML'; + result.doi = `${match[3]}/${match[4]}`; + result.unitid = `${match[3]}/${match[4]}`; + + } else if ((match = /^\/tacsgr1onlinelibrary_wiley_com\/doi\/pdf\/([0-9.]+)\/([A-Za-z0-9.-]+)$/i.exec(path)) !== null) { + // https://login.research4life.org/tacsgr1onlinelibrary_wiley_com/doi/pdf/10.1002/9781118663233.ch17 + // https://login.research4life.org/tacsgr1onlinelibrary_wiley_com/doi/pdf/10.1002/9780470768150.ch12 + result.rtype = 'BOOK_SECTION'; + result.mime = 'PDF'; + result.doi = `${match[1]}/${match[2]}`; + result.unitid = `${match[1]}/${match[2]}`; + + } else if ((match = /^\/tacsgr1www_spiedigitallibrary_org\/[A-Za-z0-9-]+\/([0-9]+)\/[0-9]+\/[A-Za-z0-9-]+\/([0-9.]+)\/([0-9.]+)(.full)?$/i.exec(path)) !== null) { + // https://login.research4life.org/tacsgr1www_spiedigitallibrary_org/conference-proceedings-of-spie/12941/3011848/Research-on-fresh-food-delivery-path-optimization-based-on-genetic/10.1117/12.3011848.full + // https://login.research4life.org/tacsgr1www_spiedigitallibrary_org/conference-proceedings-of-spie/11915/2605916/Research-on-classification-method-of-food-packaging-character-defects/10.1117/12.2605916.full + result.rtype = 'ARTICLE'; + result.mime = 'HTML'; + result.vol = match[1]; + result.doi = `${match[2]}/${match[3]}`; + result.unitid = `${match[2]}/${match[3]}`; + } + + return result; +}); diff --git a/r4l/test/r4l.2025-01-08.csv b/r4l/test/r4l.2025-01-08.csv new file mode 100644 index 00000000..834acd51 --- /dev/null +++ b/r4l/test/r4l.2025-01-08.csv @@ -0,0 +1,11 @@ +out-vol;out-doi;out-unitid;out-rtype;out-mime;in-url +;;;SEARCH;HTML;"https://hinari.summon.serialssolutions.com/#!/search?pn=1&ho=t&include.ft.matches=f&l=en&q=food" +;;;SEARCH;HTML;https://hinari.summon.serialssolutions.com/#!/search?pn=1&ho=t&include.ft.matches=f&l=en&q=applied%20economics +;10.1021/acs.jafc.8b05215;10.1021/acs.jafc.8b05215;ARTICLE;PDF;https://login.research4life.org/tacsgr1pubs_acs_org/doi/pdf/10.1021/acs.jafc.8b05215 +;10.1139/apnm-2021-0400;10.1139/apnm-2021-0400;ARTICLE;PDF;https://login.research4life.org/tacsgr1cdnsciencepub_com/doi/pdf/10.1139/apnm-2021-0400 +;10.1021/acs.jafc.8b05215;10.1021/acs.jafc.8b05215;RECORD;HTML;https://login.research4life.org/tacsgr1pubs_acs_org/doi/10.1021/acs.jafc.8b05215 +;10.1139/apnm-2021-0400;10.1139/apnm-2021-0400;RECORD;HTML;https://login.research4life.org/tacsgr1cdnsciencepub_com/doi/full/10.1139/apnm-2021-0400 +;10.1002/9781118663233.ch17;10.1002/9781118663233.ch17;BOOK_SECTION;PDF;https://login.research4life.org/tacsgr1onlinelibrary_wiley_com/doi/pdf/10.1002/9781118663233.ch17 +;10.1002/9780470768150.ch12;10.1002/9780470768150.ch12;BOOK_SECTION;PDF;https://login.research4life.org/tacsgr1onlinelibrary_wiley_com/doi/pdf/10.1002/9780470768150.ch12 +12941;10.1117/12.3011848;10.1117/12.3011848;ARTICLE;HTML;https://login.research4life.org/tacsgr1www_spiedigitallibrary_org/conference-proceedings-of-spie/12941/3011848/Research-on-fresh-food-delivery-path-optimization-based-on-genetic/10.1117/12.3011848.full +11915;10.1117/12.2605916;10.1117/12.2605916;ARTICLE;HTML;https://login.research4life.org/tacsgr1www_spiedigitallibrary_org/conference-proceedings-of-spie/11915/2605916/Research-on-classification-method-of-food-packaging-character-defects/10.1117/12.2605916.full \ No newline at end of file