Update Build.ps1

Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2023-07-11 22:10:05 +07:00
parent 52588a3dd5
commit 0429d83c29

View File

@@ -37,8 +37,8 @@ $versions = ($JSON | Where-Object -FilterScript {$_.compatiblePackages.name -eq
$LatestSupported = $versions | Sort-Object -Descending -Unique | Select-Object -First 1
$LatestSupported = $LatestSupported.replace(".", "-")
# Get unique key to generate direct link
# https://www.apkmirror.com/apk/google-inc/youtube/
# Trying to find correct APK link (not BUNDLE)
$apkMirrorLink = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/"
$Parameters = @{
Uri = $apkMirrorLink
@@ -46,21 +46,19 @@ $Parameters = @{
Verbose = $true
}
$Request = Invoke-Webrequest @Parameters
# Trying to find correct APK link (not BUNDLE)
$nameProp = $Request.ParsedHtml.getElementsByClassName("table-row headerFont")
foreach ($element in $nameProp)
{
foreach ($child in $element.children)
$Request.ParsedHtml.getElementsByClassName("table-row headerFont") | ForEach-Object -Process {
foreach ($child in $_.children)
{
if ($child.innerText -eq "nodpi")
{
$apkPackageLink = ($element.getElementsByTagName("a") | Select-Object -First 1).nameProp
$apkPackageLink = ($_.getElementsByTagName("a") | Select-Object -First 1).nameProp
break
}
}
}
$apkMirrorLink += $apkPackageLink # actual APK link (not BUNDLE)
# Get unique key to generate direct link
$Parameters = @{
Uri = $apkMirrorLink
UseBasicParsing = $false # Disabled