Skip to content

Commit

Permalink
feat(npg): backports changes from nature-asia
Browse files Browse the repository at this point in the history
  • Loading branch information
nojhamster committed Jul 26, 2024
1 parent 5b922a3 commit a319d79
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
26 changes: 21 additions & 5 deletions npg/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,34 @@ module.exports = new Parser(function analyseEC(parsedUrl) {
result.rtype = 'ARTICLE';
result.mime = 'PDF';

} else if ((match = /^\/articles\/([0-9a-z-]+)\/figures\/[0-9]+$/i.exec(path)) !== null) {
// https://www.nature.com/articles/s41467-023-41754-0/figures/1
result.rtype = 'FIGURE';
result.mime = 'HTML';
result.unitid = match[1];
} else if (/^\/[a-z-]+\/volumes$/i.test(path)) {
// https://www.nature.com/nature/volumes
result.rtype = 'TOC';
result.mime = 'HTML';

} else if ((match = /^\/nature\/volumes\/(([0-9]+)\/issues\/([0-9]+))$/i.exec(path)) !== null) {
// https://www.nature.com/nature/volumes/617/issues/7962
// https://www.nature.com/nature/volumes/596/issues/7873
result.rtype = 'TOC';
result.mime = 'HTML';
result.unitid = match[1];
result.vol = match[2];
result.issue = match[3];

} else if (path === '/siteindex/index.html') {
// http://www.nature.com/siteindex/index.html
result.rtype = 'TOC';
result.mime = 'MISC';

} else if ((match = /^\/(search|facet-search)/.exec(path)) !== null) {
// http://nano.nature.com.insb.bib.cnrs.fr/search?q=nanoparticules&workflow=article&term=concept%3A%22nanoparticles%22&new-search=true
if (params.q) {
result.mime = 'HTML';
result.rtype = 'SEARCH';
result.unitid = params.q;
}
result.mime = 'HTML';
result.rtype = 'SEARCH';

} else if ((match = /^\/nano\/([a-z0-9-]+)/i.exec(path)) !== null) {
// http://nano.nature.com.insb.bib.cnrs.fr/nano/GR-M21079
Expand Down
2 changes: 1 addition & 1 deletion npg/test/npg.2013-01-16.csv
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ nature;10.1038/news050131-3;2005;;;10.1038/news050131-3;ARTICLE;HTML;http://www.
nm;10.1038/nm0999_964;;5;9;10.1038/nm0999_964;ARTICLE;PDF;http://www.nature.com:80/nm/journal/v5/n9/pdf/nm0999_964.pdf
;10.2147/IJN.S59290;;;;IJN.S59290;RECORD_VIEW;MISC;http://nano.nature.com/related-nanoobject-summary?doi=10.2147/IJN.S59290
;;;;;GR-M21079;RECORD_VIEW;HTML;http://nano.nature.com/nano/GR-M21079
;;;;;nanoparticules;SEARCH;HTML;http://nano.nature.com/search?q=nanoparticules&workflow=article&term=concept%3A%22nanoparticles%22&new-search=true
;;;;;;SEARCH;HTML;http://nano.nature.com/search?q=nanoparticules&workflow=article&term=concept%3A%22nanoparticles%22&new-search=true
;10.1038/nmat5046;;;;nmat5046;ARTICLE;PDF;http://www.nature.com/articles/nmat5046.pdf
;10.1038/nmat5046;;;;nmat5046;ARTICLE;HTML;http://www.nature.com/articles/nmat5046
;10.1038/s41598-018-21122-5;;;;s41598-018-21122-5;ARTICLE;HTML;http://www.nature.com/articles/s41598-018-21122-5
Expand Down

0 comments on commit a319d79

Please sign in to comment.