Scaffold templates: Pull URL from doc
Link URLs could lead to redirects.
This commit is contained in:
parent
7d3e95e050
commit
139d92054f
5 changed files with 10 additions and 5 deletions
|
@ -57,7 +57,7 @@ async function doWeb(doc, url) {
|
||||||
if (items) {
|
if (items) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
Object.keys(items)
|
Object.keys(items)
|
||||||
.map(url => requestDocument(url).then(doc => scrape(doc, url)))
|
.map(url => requestDocument(url).then(scrape))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,3 +65,8 @@ async function doWeb(doc, url) {
|
||||||
await scrape(doc, url);
|
await scrape(doc, url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scrape(doc, url = doc.location.href) {
|
||||||
|
// TODO: implement or add a scrape function template
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
async function scrape(doc, url) {
|
async function scrape(doc, url = doc.location.href) {
|
||||||
// TODO adjust the url building
|
// TODO adjust the url building
|
||||||
let m = url.match(/FId=([\w\d]+)&/);
|
let m = url.match(/FId=([\w\d]+)&/);
|
||||||
if (m) {
|
if (m) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
async function scrape(doc, url) {
|
async function scrape(doc, url = doc.location.href) {
|
||||||
let translator = Zotero.loadTranslator('web');
|
let translator = Zotero.loadTranslator('web');
|
||||||
// Embedded Metadata
|
// Embedded Metadata
|
||||||
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
|
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
async function scrape(doc, url) {
|
async function scrape(doc, url = doc.location.href) {
|
||||||
// TODO adjust the selector for the lines here
|
// TODO adjust the selector for the lines here
|
||||||
let lines = doc.querySelectorAll('table#marcData tr');
|
let lines = doc.querySelectorAll('table#marcData tr');
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
async function scrape(doc, url) {
|
async function scrape(doc, url = doc.location.href) {
|
||||||
let DOI = url.match(/\/(10\.[^#?]+)/)[1];
|
let DOI = url.match(/\/(10\.[^#?]+)/)[1];
|
||||||
// TODO adjust the URL here
|
// TODO adjust the URL here
|
||||||
let risURL = `http://citation-needed.services.springer.com/v2/references/${DOI}?format=refman&flavour=citation`;
|
let risURL = `http://citation-needed.services.springer.com/v2/references/${DOI}?format=refman&flavour=citation`;
|
||||||
|
|
Loading…
Reference in a new issue