compass.utilities.url.unwrap_document_viewer_url#

unwrap_document_viewer_url(href)[source]#

Resolve a document-viewer link to the document it wraps

Some sites link to documents through a viewer page that carries the real file URL in its query string, e.g.:

/archival-document?document=https://.../ordinance.pdf&title=...

Fetching the viewer returns the page’s navigation chrome rather than the document (about 1 KB of menus instead of the ordinance), so the embedded URL is used when one is present.

Parameters:

href (str) – URL that may wrap another document URL.

Returns:

str – The embedded document URL, or href unchanged if there is none.