Skip to content

Commit 826863a

Browse files
authored
feat(elibro): update 2026 03 06 (ezpaarse-project#910)
* elibro: bump manifest version Update manifest.json for the elibro parser. * elibro: update parser routes and normalization Update parser.js for the elibro platform. * elibro: add test CSV Test CSV file generated from AnalogIST entry for the updated elibro parser using ezPAARSE test format. * Update parser.js to fix mocha test failure * Update parser.js to match test file generated from AnalogIST entry Update parser.js to match test file generated from AnalogIST entry * Update parser.js We don’t have an example in the test file that needs extra path after the numeric id. I’ve tightened the regex so we only match the id at the end of the path The proxy-handling block is removed.
1 parent de2a8a6 commit 826863a

3 files changed

Lines changed: 24 additions & 27 deletions

File tree

elibro/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"domains": [
99
"elibro.net"
1010
],
11-
"version": "2025-01-22",
11+
"version": "2026-03-06",
1212
"status": "beta"
13-
}
13+
}

elibro/parser.js

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,48 +13,32 @@ const Parser = require('../.lib/parser.js');
1313
module.exports = new Parser(function analyseEC(parsedUrl, ec) {
1414
let result = {};
1515
let path = parsedUrl.pathname;
16-
// uncomment this line if you need parameters
17-
// let param = parsedUrl.query || {};
18-
19-
// use console.error for debuging
20-
// console.error(parsedUrl);
2116

2217
let match;
2318

24-
if (/^\/(es|en)\/lc\/(csic|ipn)\/busqueda_avanzada$/i.test(path)) {
25-
// https://elibro.net/es/lc/csic/busqueda_avanzada?as_all=Negocios&as_all_op=unaccent__icontains&prev=as
26-
// https://elibro.net/es/lc/csic/busqueda_avanzada?as_all=Mundo&as_all_op=unaccent__icontains&prev=as
27-
// https://elibro-net/en/lc/ipn/busqueda_avanzada?as_all=Ciudad&as_all_op=unaccent__icontains&prev=as
19+
if (/^\/(es|en)\/lc\/(csic|ipn|sibuca|bibliotecaudb|cbues|udesa)\/busqueda_avanzada$/i.test(path)) {
2820
result.rtype = 'SEARCH';
2921
result.mime = 'HTML';
3022

31-
} else if ((match = /^\/es\/lc\/(csic|bibliotecaudb)\/titulos\/([0-9]+)$/i.exec(path)) !== null) {
32-
// https://elibro.net/es/lc/csic/titulos/58469
33-
// https://elibro.net/es/lc/csic/titulos/35303
34-
// https://elibro.net/es/lc/bibliotecaudb/titulos/271086
23+
} else if ((match = /^\/(es|en)\/lc\/(csic|ipn|sibuca|bibliotecaudb|cbues|udesa)\/titulos\/([0-9]+)$/i.exec(path)) !== null) {
3524
result.rtype = 'RECORD_VIEW';
3625
result.mime = 'HTML';
37-
result.unitid = match[2];
26+
result.unitid = match[3];
3827

39-
} else if ((match = /^\/es\/ereader\/(csic|bibliotecaudb)\/([0-9]+)$/i.exec(path)) !== null) {
40-
// https://elibro.net/es/ereader/bibliotecaudb/61256
41-
// https://elibro.net/es/ereader/csic/61699
42-
// https://elibro.net/es/ereader/csic/58469
43-
// https://elibro.net/es/ereader/bibliotecaudb/271086
28+
} else if ((match = /^\/(es|en)\/ereader\/(csic|ipn|sibuca|bibliotecaudb|cbues|udesa)\/([0-9]+)\/?$/i.exec(path)) !== null) {
29+
// e.g. https://elibro.net/es/ereader/bibliotecaudb/271086 or .../43106/
4430
result.rtype = 'BOOK';
4531
result.mime = 'PDF';
46-
result.unitid = match[2];
32+
result.unitid = match[3];
4733

48-
} else if ((match = /^\/es\/lc\/ipn\/colecciones\/([A-Za-z0-9]+)$/i.exec(path)) !== null) {
49-
// https://elibro.net/es/lc/ipn/colecciones/ELC004?prev=col
34+
} else if ((match = /^\/(es|en)\/lc\/(csic|ipn|sibuca|bibliotecaudb|cbues|udesa)\/colecciones\/([A-Za-z0-9]+)$/i.exec(path)) !== null) {
5035
result.rtype = 'TOC';
5136
result.mime = 'HTML';
5237

53-
} else if ((match = /^\/en\/ereader\/ipn\/epub\/([0-9]+)$/i.exec(path)) !== null) {
54-
// https://elibro.net/en/ereader/ipn/epub/273538?as_all=Negocios&as_all_op=unaccent__icontains&as_has_epub=true&prev=as
38+
} else if ((match = /^\/(es|en)\/ereader\/(csic|ipn|sibuca|bibliotecaudb|cbues|udesa)\/epub\/([0-9]+)$/i.exec(path)) !== null) {
5539
result.rtype = 'BOOK';
5640
result.mime = 'EPUB';
57-
result.unitid = match[1];
41+
result.unitid = match[3];
5842

5943
}
6044
return result;

elibro/test/elibro.2026-03-06.csv

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
out-unitid;out-rtype;out-mime;in-url
2+
273538;BOOK;EPUB;https://elibro.net/en/ereader/ipn/epub/273538?as_all=Negocios&as_all_op=unaccent__icontains&as_has_epub=true&prev=as
3+
;SEARCH;HTML;https://elibro-net/en/lc/ipn/busqueda_avanzada?as_all=Ciudad&as_all_op=unaccent__icontains&prev=as
4+
;TOC;HTML;https://elibro.net/es/lc/ipn/colecciones/ELC004?prev=col
5+
271086;BOOK;PDF;https://elibro.net/es/ereader/bibliotecaudb/271086
6+
271086;RECORD_VIEW;HTML;https://elibro.net/es/lc/bibliotecaudb/titulos/271086
7+
61256;BOOK;PDF;https://elibro.net/es/ereader/bibliotecaudb/61256
8+
61699;BOOK;PDF;https://elibro.net/es/ereader/csic/61699
9+
58469;BOOK;PDF;https://elibro.net/es/ereader/csic/58469
10+
58469;RECORD_VIEW;HTML;https://elibro.net/es/lc/csic/titulos/58469
11+
35303;RECORD_VIEW;HTML;https://elibro.net/es/lc/csic/titulos/35303
12+
;SEARCH;HTML;https://elibro.net/es/lc/csic/busqueda_avanzada?as_all=Mundo&as_all_op=unaccent__icontains&prev=as
13+
;SEARCH;HTML;https://elibro.net/es/lc/csic/busqueda_avanzada?as_all=Negocios&as_all_op=unaccent__icontains&prev=as

0 commit comments

Comments
 (0)