zotero/chrome/content/scaffold/templates/scrapeEM.js

21 lines
596 B
JavaScript
Raw Normal View History

async function scrape(doc, url = doc.location.href) {
2021-12-29 01:32:56 +00:00
let translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
2021-12-29 01:32:56 +00:00
translator.setDocument(doc);
2021-12-29 01:32:56 +00:00
translator.setHandler('itemDone', (_obj, item) => {
// TODO adjust if needed:
2021-12-29 01:32:56 +00:00
item.section = 'News';
item.complete();
});
2021-12-29 01:32:56 +00:00
let em = await translator.getTranslatorObject();
em.itemType = 'newspaperArticle';
// TODO map additional meta tags here, or delete completely
em.addCustomFields({
'twitter:description': 'abstractNote'
});
2021-12-29 01:32:56 +00:00
await em.doWeb(doc, url);
}