Skip to content

Commit

Permalink
Merge pull request ezpaarse-project#795 from OCLC-Developer-Network/n…
Browse files Browse the repository at this point in the history
…iireo

Updated niireo parser
  • Loading branch information
felixleo22 authored Feb 29, 2024
2 parents 0f43e9e + 7c804d2 commit 514d8f9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
21 changes: 21 additions & 0 deletions niireo/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,31 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {
result.rtype = 'RECORD_VIEW';
result.mime = 'HTML';
result.unitid = match[1];
} else if ((match = /^\/oja\/ART([0-9]+)\/?([a-z]{2})?$/i.exec(path)) !== null) {
// https://reo.nii.ac.jp/oja/ART1000061051/en
result.rtype = 'RECORD_VIEW';
result.mime = 'HTML';
result.unitid = `ART${match[1]}`;
} else if (/^\/hss\/searchresult$/i.test(path)) {
// https://reo.nii.ac.jp/hss/searchresult
result.rtype = 'SEARCH';
result.mime = 'HTML';
} else if (/^\/oja\/advance$/i.test(path)) {
// https://reo.nii.ac.jp/oja/advance
result.rtype = 'SEARCH';
result.mime = 'HTML';
} else if ((match = /^\/oja\/HtmlIndicate\/html\/vol_issues\/SUP0000002000\/JOU([0-9]+)\/vol_issue_list(_en)?.html$/i.exec(path)) !== null) {
// https://reo.nii.ac.jp/oja/HtmlIndicate/html/vol_issues/SUP0000002000/JOU0002000011/vol_issue_list_en.html
// https://reo.nii.ac.jp/oja/HtmlIndicate/html/vol_issues/SUP0000002000/JOU0002000014/vol_issue_list_en.html
result.rtype = 'TOC';
result.mime = 'HTML';
result.unitid = `JOU${match[1]}`;
} else if ((match = /^\/oja\/HtmlIndicate\/Contents\/SUP0000002000\/JOU([0-9]+)\/ISS([0-9]+)\/ART([0-9]+)\/ART([0-9]+).pdf$/i.exec(path)) !== null) {
// https://reo.nii.ac.jp/oja/HtmlIndicate/Contents/SUP0000002000/JOU0002000014/ISS0010000855/ART1000067239/ART1000067239.pdf
// https://reo.nii.ac.jp/oja/HtmlIndicate/Contents/SUP0000002000/JOU0000000000/ISS1010000366/ART1000036996/ART1000036996.pdf
result.rtype = 'ARTICLE';
result.mime = 'PDF';
result.unitid = `ART${match[3]}`;
}

return result;
Expand Down
10 changes: 10 additions & 0 deletions niireo/test/NIIREO.2024-02-26.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
out-unitid;out-rtype;out-mime;in-url
ART1000036996;ARTICLE;PDF;https://reo.nii.ac.jp/oja/HtmlIndicate/Contents/SUP0000002000/JOU0000000000/ISS1010000366/ART1000036996/ART1000036996.pdf
ART1000067239;ARTICLE;PDF;https://reo.nii.ac.jp/oja/HtmlIndicate/Contents/SUP0000002000/JOU0002000014/ISS0010000855/ART1000067239/ART1000067239.pdf
JOU0002000014;TOC;HTML;https://reo.nii.ac.jp/oja/HtmlIndicate/html/vol_issues/SUP0000002000/JOU0002000014/vol_issue_list_en.html
JOU0002000011;TOC;HTML;https://reo.nii.ac.jp/oja/HtmlIndicate/html/vol_issues/SUP0000002000/JOU0002000011/vol_issue_list_en.html
ART1000061051;RECORD_VIEW;HTML;https://reo.nii.ac.jp/oja/ART1000061051/en
;SEARCH;HTML;https://reo.nii.ac.jp/oja/advance
2000000000215788;RECORD;HTML;https://reo.nii.ac.jp/hss/2000000000215788/fulltext/ja
2200000000667829;RECORD_VIEW;HTML;https://reo.nii.ac.jp/hss/2200000000667829/ja
;SEARCH;HTML;https://reo.nii.ac.jp/hss/searchresult
4 changes: 0 additions & 4 deletions niireo/test/niireo.2022-12-26.csv

This file was deleted.

0 comments on commit 514d8f9

Please sign in to comment.