Updating webarchives

Exactly.

No. They are different things. The WebResourceURL is the URL that Safari reports while capturing a webarchive. It’s saved in the webarchive and not visible to users (unless you open the webarchive in BBEdit). DEVONthink uses it do populate the record’s URL property:

Changing the URL property in DEVONthink’s inspector that has no effect on

  • the content of a webarchive
  • the WebResourceURL of a webarchive

That’s why you used the script to update the WebResourceURL with the DEVONthink URL.

Can’t say for sure as I can’t test it (easily).

What I know is that if I create a webarchive via AppleScript DEVONthink will follow redirects but it doesn’t use the redirected URL to populate the DEVONthink URL property. This means created via AppleScript we get a webarchive with the redirected URL’s content but the URL we see in DEVONthink is the one we provided in the script.

I guess it’s sufficient to use Reload, DEVONthink will probably follow redirects and you just have to use Update Captured Archive afterwards.

Look at the capture, DEVONthink automatically updated the URL in the view pane:

And it was also updated in the inspector, just checked this. So you probably won’t need the script anymore.

Yes.

  • Reload loads the WebResourceURL in the current tab
  • Update Captured Archive saves what’s loaded, i.e. writes the currently visible content to disk

That means

  • if you use Update Captured Archive without previously using Reload you only save what’s currently visible. In your case that was broken content, that’s why Update Captured Archive didn’t seem to work for you.

  • if you use Reload without using Update Captured Archive afterwards you don’t change the webarchive record, i.e. nothing is written to disk.

So

  • Reload → acts on the tab’s content
  • Update Captured Archive → acts on the file’s content

To update and save a webarchive’s content you need to use both.