Skip to content

Commit

Permalink
Merge pull request #847 from OCLC-Developer-Network/ks
Browse files Browse the repository at this point in the history
develop parser ks
  • Loading branch information
felixleo22 authored Aug 19, 2024
2 parents af39a22 + a82f76c commit 309ab16
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ks/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"longname": "Kyobo Scholar",
"name": "ks",
"describe": "Recognizes the accesses to the platform Kyobo Scholar",
"contact": "Violita Kovchegov",
"pkb": false,
"docurl": "https://analyses.ezpaarse.org/platforms/66b6324cddbca40e3a4ed278",
"domains": [
"scholar.kyobobook-co.kr",
"scholar.kyobobook.co.kr",
"wviewer.kyobobook.co.kr"
],
"version": "2024-08-16",
"status": "beta"
}
67 changes: 67 additions & 0 deletions ks/parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/env node

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

/**
* Recognizes the accesses to the platform Kyobo Scholar
* @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 = /^\/volume\/detail\/([0-9]+)$/i.exec(path)) !== null) {
// https://scholar.kyobobook.co.kr/volume/detail/158200
// https://scholar.kyobobook.co.kr/volume/detail/137447
result.rtype = 'ISSUE';
result.mime = 'HTML';
result.unitid = match[1];

} else if ((match = /^\/academy\/detail\/([0-9]+)$/i.exec(path)) !== null) {
// https://scholar.kyobobook.co.kr/academy/detail/20290
// https://scholar.kyobobook.co.kr/academy/detail/20285
result.rtype = 'TOC';
result.mime = 'HTML';
result.unitid = match[1];

} else if ((match = /^\/journal\/detail\/([0-9]+)$/i.exec(path)) !== null) {
// https://scholar.kyobobook.co.kr/journal/detail/2091
// https://scholar.kyobobook.co.kr/journal/detail/3143
result.rtype = 'RECORD';
result.mime = 'HTML';
result.unitid = match[1];

} else if ((match = /^\/pdfViewer\/([a-zA-Z0-9-=_]+)$/i.exec(path)) !== null) {
// https://wviewer.kyobobook.co.kr/pdfViewer/MjMxOTJlZmYwZWJiNGZhNTJiMDU5ZDlkMDAyM2I1ODQyMjg5Nzg2ZTczMzc1NWRiYmI1ZWQ0ZjAzODc0ODZkYg==
// https://wviewer.kyobobook.co.kr/pdfViewer/YjRiYTcyN2RmZmNkMTNhMTU2Y2E1ZDQ0ZjA2YzlmMDRlZGE5ODA1OWI1MjJlMzUzY2NiNDUyNmIxZGNjNTQxYQ==
result.rtype = 'BOOK';
result.mime = 'PDF';
result.unitid = match[1];

} else if (/^\/search\/article\/total$/i.test(path)) {
// https://scholar.kyobobook.co.kr/search/article/total?keyword=culture
// https://scholar.kyobobook.co.kr/search/article/total?keyword=metaverse
result.rtype = 'SEARCH';
result.mime = 'HTML';

} else if ((match = /^\/article\/detail\/([0-9]+)$/i.exec(path)) !== null) {
// https://scholar.kyobobook-co.kr/article/detail/4010068538557
// https://scholar.kyobobook.co.kr/article/detail/4010023232997
result.rtype = 'ARTICLE';
result.mime = 'HTML';
result.unitid = match[1];
}

return result;
});
15 changes: 15 additions & 0 deletions ks/test/ks.2024-08-16.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
out-unitid;out-rtype;out-mime;in-url
4010068538557;ARTICLE;HTML;https://scholar.kyobobook-co.kr/article/detail/4010068538557
4010023232997;ARTICLE;HTML;https://scholar.kyobobook.co.kr/article/detail/4010023232997
;SEARCH;HTML;https://scholar.kyobobook.co.kr/search/article/total?keyword=culture
;SEARCH;HTML;https://scholar.kyobobook.co.kr/search/article/total?keyword=metaverse
159432;ISSUE;HTML;https://scholar.kyobobook-co.kr/volume/detail/159432
158708;ISSUE;HTML;https://scholar.kyobobook.co.kr/volume/detail/158708
MjMxOTJlZmYwZWJiNGZhNTJiMDU5ZDlkMDAyM2I1ODQyMjg5Nzg2ZTczMzc1NWRiYmI1ZWQ0ZjAzODc0ODZkYg==;BOOK;PDF;https://wviewer.kyobobook.co.kr/pdfViewer/MjMxOTJlZmYwZWJiNGZhNTJiMDU5ZDlkMDAyM2I1ODQyMjg5Nzg2ZTczMzc1NWRiYmI1ZWQ0ZjAzODc0ODZkYg==
YjRiYTcyN2RmZmNkMTNhMTU2Y2E1ZDQ0ZjA2YzlmMDRlZGE5ODA1OWI1MjJlMzUzY2NiNDUyNmIxZGNjNTQxYQ==;BOOK;PDF;https://wviewer.kyobobook.co.kr/pdfViewer/YjRiYTcyN2RmZmNkMTNhMTU2Y2E1ZDQ0ZjA2YzlmMDRlZGE5ODA1OWI1MjJlMzUzY2NiNDUyNmIxZGNjNTQxYQ==
2091;RECORD;HTML;https://scholar.kyobobook.co.kr/journal/detail/2091
3143;RECORD;HTML;https://scholar.kyobobook.co.kr/journal/detail/3143
20285;TOC;HTML;https://scholar.kyobobook.co.kr/academy/detail/20285
20290;TOC;HTML;https://scholar.kyobobook.co.kr/academy/detail/20290
137447;ISSUE;HTML;https://scholar.kyobobook.co.kr/volume/detail/137447
158200;ISSUE;HTML;https://scholar.kyobobook.co.kr/volume/detail/158200

0 comments on commit 309ab16

Please sign in to comment.