@a_kawashiro/jendeley
Advanced tools
Comparing version 0.0.24 to 0.0.25
@@ -26,2 +26,3 @@ "use strict"; | ||
const gen_1 = require("./gen"); | ||
const either_1 = require("./either"); | ||
const load_db_1 = require("./load_db"); | ||
@@ -291,6 +292,13 @@ const path_util_1 = require("./path_util"); | ||
let { got } = yield import("got"); | ||
const res = yield got(url); | ||
const root = cheerio_1.default.load(res.body); | ||
const title = root("title").text(); | ||
return title; | ||
try { | ||
const res = yield got(url); | ||
const root = cheerio_1.default.load(res.body); | ||
const title = root("title").text(); | ||
return (0, either_1.genRight)(title); | ||
} | ||
catch (_a) { | ||
const err = "Failed to get title from " + url; | ||
logger_1.logger.warn(err); | ||
return (0, either_1.genLeft)(err); | ||
} | ||
}); | ||
@@ -306,4 +314,21 @@ } | ||
JSON.stringify(req)); | ||
let title = ""; | ||
if (req.title !== "") { | ||
title = req.title; | ||
} | ||
else { | ||
const titleOrError = yield getTitleFromUrl(req.url); | ||
if (titleOrError._tag === "left") { | ||
const r = { | ||
isSucceeded: false, | ||
message: titleOrError.left, | ||
}; | ||
response.status(500).json(r); | ||
return; | ||
} | ||
else { | ||
title = titleOrError.right; | ||
} | ||
} | ||
const jsonDB = (0, load_db_1.loadDB)(dbPath, false); | ||
const title = req.title == "" ? yield getTitleFromUrl(req.url) : req.title; | ||
const date = new Date(); | ||
@@ -310,0 +335,0 @@ const date_tag = new Date(date.getTime() - date.getTimezoneOffset() * 60000) |
@@ -38,3 +38,3 @@ "use strict"; | ||
exports.ENTRY_DATA_FROM_ARXIV = ENTRY_DATA_FROM_ARXIV; | ||
const JENDELEY_VERSION = "0.0.24"; | ||
const JENDELEY_VERSION = "0.0.25"; | ||
exports.JENDELEY_VERSION = JENDELEY_VERSION; | ||
@@ -41,0 +41,0 @@ const JENDELEY_DIR = ".jendeley"; |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "0.0.24", | ||
"version": "0.0.25", | ||
"description": "", | ||
@@ -9,0 +9,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
4289873
6277
12