Skip to content

Commit

Permalink
feat(thesesfr): added PHD_THESIS match
Browse files Browse the repository at this point in the history
  • Loading branch information
oxypomme committed Jul 17, 2024
1 parent 1e9a588 commit 2998e80
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 18 additions & 1 deletion thesesfr/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,24 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {

let match;

if ((match = /^\/([0-9]{8}[0-9X])$/i.exec(path)) !== null) {
if ((match = /^\/api\/v1\/document\/([0-9a-z]+)$/i.exec(path)) !== null) {
// /api/v1/document/2019LYSE2053
result.rtype = 'PHD_THESIS';
result.unitid = match[1];
switch (ec.status) {
case 200:
result.mime = 'PDF';
break;
case 302:
result.mime = 'HTML';
break;

default:
result.mime = 'MISC';
break;
}

} else if ((match = /^\/([0-9]{8}[0-9X])$/i.exec(path)) !== null) {
// /258987731
result.rtype = 'BIO';
result.mime = 'HTML';
Expand Down
4 changes: 3 additions & 1 deletion thesesfr/test/thesesfr.2024-01-09.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
out-unitid;out-rtype;out-mime;out-ppn;out-publication_date;out-institution_code;in-url
2023UPASP097;ABS;HTML;;2023;UPAS;https://beta.theses.fr/2023UPASP097
s366354;ABS;HTML;;;;https://beta.theses.fr/s366354
258987731;BIO;HTML;258987731;;;https://beta.theses.fr/258987731
258987731;BIO;HTML;258987731;;;https://beta.theses.fr/258987731
2019LYSE2053;PHD_THESIS;MISC;;;;https://theses.fr/api/v1/document/2019LYSE2053
2010AIX22039;PHD_THESIS;MISC;;;;https://theses.fr/api/v1/document/2010AIX22039

0 comments on commit 2998e80

Please sign in to comment.