Skip to content

Instantly share code, notes, and snippets.

@alastorid
Forked from shuax/getedge.py
Last active December 14, 2020 09:29
Show Gist options
  • Save alastorid/db6a6f422daa720f48160a19030e0755 to your computer and use it in GitHub Desktop.
Save alastorid/db6a6f422daa720f48160a19030e0755 to your computer and use it in GitHub Desktop.
You may need a large screen to view the full URL
$what_you_like = @{}
foreach($processor_arch in @("x64","x86"))
{
foreach($channel in @("stable", "Beta", "Canary", "Dev"))
{
$versionObj = $null
$RequestArg = @{
TimeoutSec = 1800
Uri = "https://msedge.api.cdp.microsoft.com/api/v1.1/contents/Browser/namespaces/Default/names/msedge-{0}-win-{1}/versions/latest?action=select" -f ($channel, $processor_arch)
Method = "POST"
Body = "targetingAttributes="
UseBasicParsing = $true
}
try
{
$versionObj = Invoke-RestMethod @RequestArg
}
catch
{
$_.Exception
}
if($null -ne $versionObj)
{
$downloadInfoObj = $null
$RequestArg = @{
TimeoutSec = 1800
Uri = "https://msedge.api.cdp.microsoft.com/api/v1.1/contents/Browser/namespaces/Default/names/{0}/versions/{1}/files?action=GenerateDownloadInfo" -f ($versionObj.ContentId.Name, $versionObj.ContentId.Version)
Method = "POST"
Body = "targetingAttributes="
UseBasicParsing = $true
}
try
{
$downloadInfoObj = Invoke-RestMethod @RequestArg
}
catch
{
$_.Exception
}
if($null -eq $what_you_like[$channel])
{
$what_you_like[$channel] = @()
}
if($null -ne $downloadInfoObj)
{
$what_you_like[$channel] += @($downloadInfoObj |sort {$_.FileId.Length } | select -first 1 |select FileId,Url)
}
}
}
}
($what_you_like| ConvertTo-Json -depth 7).replace('\u0026', '&')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment