Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to Microsoft Download Center (e.g. PowerBI) #125

Open
Vexxer1 opened this issue Dec 17, 2024 · 0 comments
Open

Changes to Microsoft Download Center (e.g. PowerBI) #125

Vexxer1 opened this issue Dec 17, 2024 · 0 comments

Comments

@Vexxer1
Copy link

Vexxer1 commented Dec 17, 2024

Hi Dan,
it seems that Microsoft did some changes to their Download Center, which broke the scraping like you did for PowerBI / PowerBI Report Server.

I've dug into the new style a bit and found that the details.aspx now has a <script> Block which stores a JSON Text. So I've written a bit of code around it... it's far from nice, but maybe saves you some time figuring it out (if you have not yet done it). Here is an example with PowerBI Report Server.

$url = "https://www.microsoft.com/en-us/download/details.aspx?id=105945"

function Get-TextBetweenTwoStrings ([string]$startPattern, [string]$endPattern, [string]$text){
    $pattern = '(?is){0}(.*?){1}' -f [regex]::Escape($startPattern), [regex]::Escape($endPattern)
    [regex]::Match($text,$pattern).Groups[1].Value
}

$req = invoke-webrequest $url -UseBasicParsing

$script = Get-TextBetweenTwoStrings -startPattern "<script>window.__DLCDetails__=" -endPattern "</script>" -text $req.Content
$json = $script | convertfrom-json

$json.dlcDetailsView.downloadFile

This gives you a PowerShell Object with the neccessary information.

isPrimary     : true
name          : PowerBIReportServer.exe
url           : https://download.microsoft.com/download/2/d/a/2da81ea3-040a-4d08-a593-6bebc3bf97e8/PowerBIReportServer.exe
size          : 565004992
version       : 15.0.1116.121
datePublished : 2024-09-26T21:43:46.9597693Z

isPrimary     : false
name          : PBIDesktopSetupRS.exe
url           : https://download.microsoft.com/download/2/d/a/2da81ea3-040a-4d08-a593-6bebc3bf97e8/PBIDesktopSetupRS.exe
size          : 507011936
version       : 15.0.1116.121
datePublished : 2024-09-26T21:43:46.9597693Z

isPrimary     : false
name          : PBIDesktopSetupRS_x64.exe
url           : https://download.microsoft.com/download/2/d/a/2da81ea3-040a-4d08-a593-6bebc3bf97e8/PBIDesktopSetupRS_x64.exe
size          : 550615336
version       : 15.0.1116.121
datePublished : 2024-09-26T21:43:46.9597693Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant