Skip to content

Commit

Permalink
develop parser hrb
Browse files Browse the repository at this point in the history
  • Loading branch information
nthu31 committed Aug 9, 2024
1 parent 55786a0 commit 4216a46
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
13 changes: 13 additions & 0 deletions hrb/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"longname": "HyRead ebook",
"name": "hrb",
"describe": "Recognizes the accesses to the platform HyRead ebook",
"contact": "Violita Kovchegov",
"pkb": false,
"docurl": "https://analyses.ezpaarse.org/platforms/6169500277b41e76a7188dfd",
"domains": [
"ntust.ebook.hyread.com.tw"
],
"version": "2024-08-09",
"status": "beta"
}
33 changes: 33 additions & 0 deletions hrb/parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env node

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

/**
* Recognizes the accesses to the platform HyRead ebook
* @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 (/^\/bookDetail.jsp$/i.test(path)) {
// http://ntust.ebook.hyread.com.tw/bookDetail.jsp?id=177049
// http://ntust.ebook.hyread.com.tw/bookDetail.jsp?id=203257
result.rtype = 'RECORD';
result.mime = 'HTML';
result.unitid = param.id;

}
return result;
});
3 changes: 3 additions & 0 deletions hrb/test/hrb.2024-08-09.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
out-unitid;out-rtype;out-mime;in-url
177049;RECORD;HTML;http://ntust.ebook.hyread.com.tw/bookDetail.jsp?id=177049
203257;RECORD;HTML;http://ntust.ebook.hyread.com.tw/bookDetail.jsp?id=203257

0 comments on commit 4216a46

Please sign in to comment.