Any way to get content id from tiny link or link from share content dialog

For correct working of my macro I need to take content ids from content body. There aren’t any problem with links from browser as https://.atlassian.net/wiki/spaces//pages//
But I can’t get ids from short links(tiny links or links from share dialog) because they redirects you to pages with links as above.
I tried to do request to get location for redirecting but it’s not possible because of CORS error, AP.request returns 403 error.
So, Is there any way how to get page id?

Here are a few code samples that implement the algorithm for tiny links:
https://confluence.atlassian.com/confkb/how-to-programmatically-generate-the-tiny-link-of-a-confluence-page-956713432.html

Hi, thanks for answering. I’ll try to convert the algorithm to decode page id.
But what about links from the “Share” dialog? I noticed that it generates different links each time.

Hmm, that seems new and specific to the Cloud version, I couldn’t find anything about that and it’s not so obvious from the URL itself or the redirect as to how to decode it :frowning: