I need to download the newest version of a bunch of files. That works pretty straight forward using direct links.
The links I need to use look something like this: https://d.apkpure.com/b/APK/org.telegram.messenger?version=latest
It’s the link of the download button, which generates a new direct download link every time.
In the web browser this link will download the latest Telegram .apk. I can not use the direct download link in my script since it will change, and the link to the button will result in a html file.
I tried it using curl, Invoke-Webrequest and DownloadFile(). It works seamlessly using the direct download links generated when using a web browser. I’d like to generate this download link using a script.
How do I use this download button to always get the latest file/latest download link?
2
Answers
My Code:
To get final redirected url use this script:
Then you can download via Invoke-WebRequest