Skip to content

Commit

Permalink
Merge branch 'master' into v0.0.34
Browse files Browse the repository at this point in the history
  • Loading branch information
xkopenreview authored Sep 30, 2024
2 parents 621fb59 + b871d7f commit ba8b4d5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
16 changes: 12 additions & 4 deletions packages/client/src/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,9 +869,18 @@ export default class Tools {
static async extractAbstract(url) {
const metaExtractionUrl = 'https://meta-extraction-wivlbyt6ga-uc.a.run.app/metadata';
const queryString = generateQueryString({ url });
const result = await fetch(`${metaExtractionUrl}?${queryString}`, {
method: 'GET',
});
let result;

try {
result = await fetch(`${metaExtractionUrl}?${queryString}`, {
method: 'GET',
});
} catch (error) {
throw new OpenReviewError({
name: 'ExtractAbstractError',
message: error,
});
}

if (result.status === 200) {
return result.json();
Expand All @@ -883,6 +892,5 @@ export default class Tools {
message: (contentType && contentType.indexOf('application/json') !== -1) ? JSON.stringify(await result.json()) : await result.text(),
status: result.status || 500
});

}
}
2 changes: 1 addition & 1 deletion packages/meta-extraction/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openreview/meta-extraction",
"version": "0.0.7",
"version": "0.0.8",
"description": "Extract abstracts for DBLP papers",
"main": "src/index.js",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions packages/meta-extraction/src/abstractExtractionRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,8 @@ const worldscientificComRule = {
const iscaSpeechOrgRule = {
shouldApplyRule: (url) => /isca-speech.org/.test(url) || /isca-archive.org/.test(url),
executeRule: async (html, page) => {
const abstract = await selectElemTextEvidence(page, 'div.w3-card>p');
const pdf = await selectElemAttrEvidence(page, 'div.w3-card>a', 'href');
const abstract = await selectElemTextEvidence(page, 'div#abstract>p');
const pdf = await selectElemAttrEvidence(page, 'div.w3-content div.w3-center a', 'href');
const allEvidence = [
{ type: 'abstract', value: abstract },
{ type: 'pdf', value: pdf }
Expand Down
2 changes: 1 addition & 1 deletion packages/meta-extraction/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const shouldEnableMultiRedirect = (url) => [/doi.org/, /linkinghub.elsevier.com/

const getTimeout = (url) => {
const defaultTimeout = 15_000;
if ([/doi.org/, /spiedigitallibrary.org/, /iospress.com/].some((regex) => regex.test(url))) return defaultTimeout*3;
if ([/doi.org/, /spiedigitallibrary.org/, /iospress.com/,/export.arxiv.org/].some((regex) => regex.test(url))) return defaultTimeout*3;
return defaultTimeout;
};

Expand Down
8 changes: 4 additions & 4 deletions packages/meta-extraction/test/test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ba8b4d5

Please sign in to comment.