translator for a site that has no HTML on load

15 views
Skip to first unread message

weng...@yahoo.com

unread,
Sep 4, 2025, 3:15:06 AM (3 days ago) Sep 4
to zotero-dev
Hi all.
I'm still new to Zotero translators and making only slow progress to understanding the ones I inherited.
I have a standalone app on a network that is not connected to the internet, so all of the translators are custom built and not found in the repository.
One site I have not had any success with so far doesn't have any HTML inside the body when the page loads.
It has only a single empty div
and a "tri-root" tag and then it calls a series of script src.......js files.
I assume what is happening is the JS is putting the HTML body together and then inserting it into the one of these tags or the body directly. But I can't see the html in the page source, and if I save the html page and look at the html source of my local copy, it's gibberish.
I can see the page rendered in my browser, so I know the HTML for that rendering is present.
My question is, can I still write a translator that will capture information on a page when the HTML isn't present when the page loads.

I have a larger question, but I don't want to piggyback it here, so suffice it to say I can't currently work in Scaffold and I am largely working blind in terms of getting feedback as I modify the translators. I'll post a second discussion for this, but it is relevant here too. I need to see what the translator sees.

Thanks for any information/advice.

Abe Jellinek

unread,
Sep 4, 2025, 11:35:41 AM (3 days ago) Sep 4
to zoter...@googlegroups.com
In detectWeb(), call ZU.monitorDOMChanges(doc.body) before you return false. That will tell the Connector to call detectWeb() again when the body’s children change. If that still doesn’t make detection work, you can pass a second argument to configure the MutationObserver - { childList: true, subtree: true } might do it.

(In some cases, it’s better to use browser devtools to observe the API requests that the site makes, and write your translator to use the API instead of trying to scrape the rendered HTML. Depends on the site.)

--
You received this message because you are subscribed to the Google Groups "zotero-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zotero-dev+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/zotero-dev/7e0281c5-0b9a-4efb-a3a5-8a00372788e3n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages