zotero/chrome/content/scaffold/templates/scrapeEM.js
Abe Jellinek 139d92054f Scaffold templates: Pull URL from doc
Link URLs could lead to redirects.
2022-08-11 02:25:43 -04:00

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);
}