139d92054f
Link URLs could lead to redirects.
20 lines
596 B
JavaScript
20 lines
596 B
JavaScript
async function scrape(doc, url = doc.location.href) {
|
|
let translator = Zotero.loadTranslator('web');
|
|
// Embedded Metadata
|
|
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
|
|
translator.setDocument(doc);
|
|
|
|
translator.setHandler('itemDone', (_obj, item) => {
|
|
// TODO adjust if needed:
|
|
item.section = 'News';
|
|
item.complete();
|
|
});
|
|
|
|
let em = await translator.getTranslatorObject();
|
|
em.itemType = 'newspaperArticle';
|
|
// TODO map additional meta tags here, or delete completely
|
|
em.addCustomFields({
|
|
'twitter:description': 'abstractNote'
|
|
});
|
|
await em.doWeb(doc, url);
|
|
}
|