Script to convert old web snapshots to new format?

Thanks to everyone involved in the new web snapshot format, it's a huge upgrade over previous approach!

In fact, it's so transformational that I'm now working out the best way to re-snapshot all my web page items in the new format. :) (I am assuming there's no built in way to automate that in Zotero already, but if there is, please shout!)

Assuming I'll need to write a Zotero add-on or similar to do it, is there a clear way in the Zotero API to distinguish the old and new web snapshot formats (so that I know which ones need upgrading)?

Thanks for everyone's work on this front!
  • This wouldn't need to be an add-on — you could just do it via the Run JavaScript window. The easiest way to determine if it's the old or new format is just the .dateAdded of the attachment. Then you'd .getField('url') and use Zotero.Attachments.importFromURL() with the new URL and the same .parentItemID.

    We're still making some tweaks to the snapshot functionality — the Zotero beta has some fixes since 5.0.91 — so you'd probably want to hold off on this for a little while. But you could start playing around with it.

    Also note that snapshots done within app will be a bit worse in some cases than snapshots done in the connector, because of incompatibilities between SingleFile's expectations for the browser environment and what's available in the hidden browser within Zotero. In particular, you might not get deferred images below the fold, and there could be some layout problems on sites that use JS rather than CSS to adapt the layout based on the window size. But generally they should be an improvement from the previous snapshots. (In normal usage, snapshots are done in the client rather than the connector when they're for URLs other than the current page, such as when saving multiple results.)
Sign In or Register to comment.