Search code examples
macossafariwebarchive

Original URL of a saved .webarchive on macOS


We have a saved .webarchive and we want to retrieve the original URL. Is that possible?

Background. My wife filled out a long application on the web and saved a local copy, .webarchive. The instructions said that to make changes you have to go to URL of where you were when you were at a certain step of the submission. The instructions are complicated/confusing and like most of these long applications hard to deal with anyway. She doesn't have that URL. We went back to her Safari history and one URL for the site that day but that just came up with an error.

To give a sense on how the sophistication of the site, they have a link for downloading Flash Player.

We're trying to contact the site. Due in 24 hours. Fortunately what they have is OK, she just wanted to make some edits and add some info.

I looked at the 13k lines of the .webarchive in a text editor and skimming through it don't see anything obvious. There is some com.apple.print plist embedded but no URL. I looked at Get Info and no URL (some things I download from the web have the original URL).

Thank you for any help.


Solution

  • Actually, webarchive itself is in the binary plist format and can be read like .plist files. The original URL of a webarchive file, if there is one, should be stored at :WebMainResource:WebResourceURL, which can be read with:

    /usr/libexec/PlistBuddy -c 'print ":WebMainResource:WebResourceURL"' /path/to/file