Translator coding: how to remove html elements from the saved snapshot?
Hi all. I am coding a translator for personal use. The website it scrapes has a header and some other html elements that get messed up by the snapshot process. They become very irritating when attempting to view the snapshot. What I'm hoping to be able to do is remove elements that I select using xpath, but my attempts to do so have not been successful. I've attempted to use the removeChild function on the doc object, but it has given me an error message to the effect that
"parentNode.removeChild(...)" is not a function.
Is it possible to do this in Zotero translators? If so, should I be using the removeChild function? I've been alerted that distributing my translator might get me sued, so I'm not looking for troubleshooting help. I just want to know if my goal is possible.
"parentNode.removeChild(...)" is not a function.
Is it possible to do this in Zotero translators? If so, should I be using the removeChild function? I've been alerted that distributing my translator might get me sued, so I'm not looking for troubleshooting help. I just want to know if my goal is possible.
@fbennett because I'm using juris-m, and it may work differently
doc = html_cleaner(doc)
NewItem.attachments.push({
document: doc,
title: 'Page'
})
This gives me a snapshot of the page, but that snapshot still has the annoying elements even though html_cleaner(doc) definitely removes those elements.
I have also tried creating a new variable (doc2) and attaching that, but the problem persists. Any advice?
* For anyone else who stumbles across this thread, the problem I was having was that doc.getElementbyID was not defined, so I couldn't get an element to use the removeChild method. Instead I had to use the Zotero.Utilities.Xpath to get the element I needed.