2022-05-12 21:49:30 +00:00
|
|
|
async function scrape(doc, url = doc.location.href) {
|
2021-12-29 01:32:56 +00:00
|
|
|
let translator = Zotero.loadTranslator('web');
|
2019-08-02 10:09:36 +00:00
|
|
|
// Embedded Metadata
|
|
|
|
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
|
2021-12-29 01:32:56 +00:00
|
|
|
translator.setDocument(doc);
|
2019-08-02 10:09:36 +00:00
|
|
|
|
2021-12-29 01:32:56 +00:00
|
|
|
translator.setHandler('itemDone', (_obj, item) => {
|
2019-08-02 10:09:36 +00:00
|
|
|
// TODO adjust if needed:
|
2021-12-29 01:32:56 +00:00
|
|
|
item.section = 'News';
|
2019-08-02 10:09:36 +00:00
|
|
|
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'
|
2019-08-02 10:09:36 +00:00
|
|
|
});
|
2021-12-29 01:32:56 +00:00
|
|
|
await em.doWeb(doc, url);
|
2019-08-02 10:09:36 +00:00
|
|
|
}
|