Skip to content

Commit

Permalink
Merge pull request #844 from OCLC-Developer-Network/euromoitor
Browse files Browse the repository at this point in the history
develop parser euromonitor
  • Loading branch information
felixleo22 authored Aug 19, 2024
2 parents 0ef06ff + 23adb92 commit 037be95
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 12 deletions.
3 changes: 2 additions & 1 deletion euromonitor/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"www.portal.euromonitor.com",
"portal.euromonitor.com",
"euromonitor.com",
"microfrontend-passport.euromonitor.com"
"microfrontend-passport.euromonitor.com",
"download.portal.euromonitor.com"
],
"version": "2019-04-24",
"status": "beta"
Expand Down
32 changes: 30 additions & 2 deletions euromonitor/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {

// use console.error for debuging
// console.error(parsedUrl);

// let match;
let match;

if (/^\/portal\/policy\/accepttermsandconditions$/i.test(path)) {
// http://www.portal.euromonitor.com:80/portal/policy/accepttermsandconditions?ControllerName=Default&ActionName=Index
Expand All @@ -29,6 +28,10 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {
// http://www.portal.euromonitor.com:80/searchui/main.js?version=20180704_1
result.rtype = 'SEARCH';
result.mime = 'HTML';
} else if (/^\/resultslist\/index$/i.test(path)) {
// https://www.portal.euromonitor.com/resultslist/index
result.rtype = 'SEARCH';
result.mime = 'HTML';
} else if (/^\/portal\/dashboard\/analysisrelateddashboards$/i.test(path)) {
// http://www.portal.euromonitor.com:80/portal/dashboard/analysisrelateddashboards?analysisId=437029&analysisTypeId=1&_=1556038899215
result.rtype = 'REPORT';
Expand All @@ -46,6 +49,31 @@ module.exports = new Parser(function analyseEC(parsedUrl, ec) {
result.rtype = 'DATASET';
result.mime = 'HTML';
result.unitid = param._;
} else if (/^\/StatisticsEvolution\/index$/i.test(path)) {
// https://www.portal.euromonitor.com/StatisticsEvolution/index
result.rtype = 'DATASET';
result.mime = 'HTML';
} else if (/^\/analysis\/tab$/i.test(path)) {
// https://www.portal.euromonitor.com/analysis/tab
result.rtype = 'ANALYSIS';
result.mime = 'HTML';
} else if (/^\/CountryReportsApi\/download-report$/i.test(path) && param.documentId !== undefined) {
// https://api.passport.euromonitor.com/CountryReportsApi/download-report?documentId=21003
// https://api.passport.euromonitor.com/CountryReportsApi/download-report?documentId=2100395
result.rtype = 'ANALYSIS';
result.mime = 'PDF';
result.unitid = param.documentId;
} else if (/^\/dashboard\/dashboarddetails$/i.test(path) && param.id !== undefined) {
// https://www.portal.euromonitor.com/dashboard/dashboarddetails?id=766edb3d-2fe1-4af9-8f65-e4d88fd2e762
// https://www.portal.euromonitor.com/dashboard/dashboarddetails?id=e41c23bc-20d4-4442-99d0-87df52e25c35
result.rtype = 'MAP';
result.mime = 'HTML';
result.unitid = param.id;
} else if ((match = /^\/documents\/([a-zA-Z0-9%-/]+).ppt$/i.exec(path)) !== null) {
// https://download.portal.euromonitor.com/documents/67/ppt/f-1970309-39143267.ppt?sv=2019-02-02&sr=b&sig=zW0XRGYbYieXfjjyD9qWokohhdL0AKLdXWDlvH3l594%3D&se=2024-08-06T18%3A38%3A56Z&sp=r&rscd=attachment%3B%20filename%20%3D%20Analysis.ppt
result.rtype = 'ANALYSIS';
result.mime = 'MISC';
result.unitid = match[1];
}
return result;
});
9 changes: 0 additions & 9 deletions euromonitor/test/euromonitor.2019-04-24.csv

This file was deleted.

13 changes: 13 additions & 0 deletions euromonitor/test/euromonitor.2024-08-12.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
out-title_id;out-unitid;out-rtype;out-mime;in-url
;67/ppt/f-1970309-39143267;ANALYSIS;MISC;https://download.portal.euromonitor.com/documents/67/ppt/f-1970309-39143267.ppt?sv=2019-02-02&sr=b&sig=zW0XRGYbYieXfjjyD9qWokohhdL0AKLdXWDlvH3l594%3D&se=2024-08-06T18%3A38%3A56Z&sp=r&rscd=attachment%3B%20filename%20%3D%20Analysis.ppt
;e41c23bc-20d4-4442-99d0-87df52e25c35;MAP;HTML;https://www.portal.euromonitor.com/dashboard/dashboarddetails?id=e41c23bc-20d4-4442-99d0-87df52e25c35
;766edb3d-2fe1-4af9-8f65-e4d88fd2e762;MAP;HTML;https://www.portal.euromonitor.com/dashboard/dashboarddetails?id=766edb3d-2fe1-4af9-8f65-e4d88fd2e762
;2100395;ANALYSIS;PDF;https://api.passport.euromonitor.com/CountryReportsApi/download-report?documentId=2100395
;21003;ANALYSIS;PDF;https://api.passport.euromonitor.com/CountryReportsApi/download-report?documentId=21003
;;ANALYSIS;HTML;https://www.portal.euromonitor.com/analysis/tab
;;DATASET;HTML;https://www.portal.euromonitor.com/StatisticsEvolution/index
;;SEARCH;HTML;https://www.portal.euromonitor.com/resultslist/index
;1556039200418;DATASET;HTML;http://www.portal.euromonitor.com:80/portal/statisticsevolution/exporttoolsasync?measureTypeId=119&_=1556039200418
462055;462055;REPORT;PDF;http://www.portal.euromonitor.com:80/portal/analysis/downloadpdf?analysisId=462055&analysisTypeId=1&itemTypeId=48&elementId=0&elementTypeId=0&checksum=014264A2BDEE0CCDE0F27E9FBC42BAFD&searchString=TesT
431730;1556038977927;REPORT;HTML;http://www.portal.euromonitor.com:80/portal/dashboard/analysisrelateddashboards?analysisId=431730&analysisTypeId=1&_=1556038977927
;;SEARCH;HTML;https://www.portal.euromonitor.com/searchui/main.js?version=20180704_1

0 comments on commit 037be95

Please sign in to comment.