mirror of
https://github.com/JDM170/ReVanced_Builder
synced 2025-11-29 14:41:46 +07:00
Compare commits
6 Commits
2023.07.09
...
2023.07.31
| Author | SHA1 | Date | |
|---|---|---|---|
| faf94e4e29 | |||
|
ad506f52ce
|
|||
|
a110a4b243
|
|||
|
71d741090a
|
|||
|
5acbf45673
|
|||
|
0429d83c29
|
21
Build.ps1
21
Build.ps1
@@ -18,6 +18,10 @@
|
||||
# Requires -Version 5.1
|
||||
# Doesn't work on PowerShell 7.2 due it doesn't contains IE parser engine. You have to use a 3rd party module to make it work like it's presented in CI/CD config: AngleSharp
|
||||
|
||||
# Invoke-Webrequest speedup workaround. Improved downloads speeds significantly.
|
||||
# Ref: https://www.codewrecks.com/post/azdo/pills/powershell-download/
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
# Download all files to "Script location folder\ReVanced"
|
||||
$WorkingFolder = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
if (-not (Test-Path -Path "$WorkingFolder\ReVanced"))
|
||||
@@ -37,7 +41,7 @@ $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
|
||||
# Trying to find correct APK link (not BUNDLE)
|
||||
# https://www.apkmirror.com/apk/google-inc/youtube/
|
||||
$apkMirrorLink = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/"
|
||||
$Parameters = @{
|
||||
@@ -46,21 +50,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
|
||||
@@ -147,6 +149,11 @@ $Parameters = @{
|
||||
}
|
||||
Invoke-RestMethod @Parameters
|
||||
|
||||
# Sometimes older version of zulu-jdk causes conflict, so remove older version before proceeding.
|
||||
if (Test-Path -Path "$WorkingFolder\ReVanced\jdk") {
|
||||
Remove-Item -Path "$WorkingFolder\ReVanced\jdk" -Recurse -Force
|
||||
}
|
||||
|
||||
# https://github.com/ScoopInstaller/Java/blob/master/bucket/zulu-jdk.json
|
||||
$Parameters = @{
|
||||
Uri = "https://raw.githubusercontent.com/ScoopInstaller/Java/master/bucket/zulu-jdk.json"
|
||||
|
||||
@@ -4,13 +4,10 @@ $Parameters = @{
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
# $Patchesvtag = (Invoke-RestMethod @Parameters).tag_name
|
||||
# $Patchestag = $Patchesvtag.replace("v", "")
|
||||
$apiResult = Invoke-RestMethod @Parameters
|
||||
$URL = ($apiResult.assets | Where-Object -FilterScript {$_.content_type -eq "application/java-archive"}).browser_download_url
|
||||
$TAG = $apiResult.tag_name
|
||||
$Parameters = @{
|
||||
# Uri = "https://github.com/revanced/revanced-patches/releases/download/$Patchesvtag/revanced-patches-$Patchestag.jar"
|
||||
Uri = $URL
|
||||
Outfile = "Temp\revanced-patches.jar"
|
||||
UseBasicParsing = $true
|
||||
|
||||
@@ -13,17 +13,39 @@ $LatestSupportedYT = $LatestSupported.replace(".", "-")
|
||||
$AngleSharpAssemblyPath = (Get-ChildItem -Path (Split-Path -Path (Get-Package -Name AngleSharp).Source) -Filter "*.dll" -Recurse | Where-Object -FilterScript {$_ -match "standard"} | Select-Object -Last 1).FullName
|
||||
Add-Type -Path $AngleSharpAssemblyPath
|
||||
|
||||
# Get unique key to generate direct link
|
||||
# Create parser object
|
||||
$angleparser = New-Object -TypeName AngleSharp.Html.Parser.HtmlParser
|
||||
|
||||
# Trying to find correct APK link (not BUNDLE)
|
||||
# https://www.apkmirror.com/apk/google-inc/youtube/
|
||||
$apkMirrorLink = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-2-android-apk-download/"
|
||||
# $apkMirrorLink = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-android-apk-download/"
|
||||
$apkMirrorLink = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/"
|
||||
$Parameters = @{
|
||||
Uri = $apkMirrorLink
|
||||
UseBasicParsing = $false # Disabled
|
||||
Verbose = $true
|
||||
}
|
||||
$Request = Invoke-Webrequest @Parameters
|
||||
$Parsed = (New-Object -TypeName AngleSharp.Html.Parser.HtmlParser).ParseDocument($Request.Content)
|
||||
$Parsed = $angleparser.ParseDocument($Request.Content)
|
||||
$Parsed.All | Where-Object -FilterScript {$_.ClassName -match "table-row headerFont"} | ForEach-Object -Process {
|
||||
foreach($child in $_.children)
|
||||
{
|
||||
if ($child.InnerHtml -eq "nodpi")
|
||||
{
|
||||
$apkPackageLink = (($_.getElementsByTagName("a") | Select-Object -First 1).Href).Substring(57)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
$apkMirrorLink += $apkPackageLink # actual APK link (not BUNDLE)
|
||||
|
||||
# Get unique key to generate direct link
|
||||
$Parameters = @{
|
||||
Uri = $apkMirrorLink
|
||||
UseBasicParsing = $false # Disabled
|
||||
Verbose = $true
|
||||
}
|
||||
$Request = Invoke-Webrequest @Parameters
|
||||
$Parsed = $angleparser.ParseDocument($Request.Content)
|
||||
$Key = $Parsed.All | Where-Object -FilterScript {$_.ClassName -match "accent_bg btn btn-flat downloadButton"} | ForEach-Object -Process {$_.Search}
|
||||
|
||||
$Parameters = @{
|
||||
@@ -32,7 +54,7 @@ $Parameters = @{
|
||||
Verbose = $true
|
||||
}
|
||||
$Request = Invoke-Webrequest @Parameters
|
||||
$Parsed = (New-Object -TypeName AngleSharp.Html.Parser.HtmlParser).ParseDocument($Request.Content)
|
||||
$Parsed = $angleparser.ParseDocument($Request.Content)
|
||||
$Key = ($Parsed.All | Where-Object -FilterScript { $_.InnerHtml -eq "here" }).Search
|
||||
|
||||
# Finally, get the real link
|
||||
|
||||
Reference in New Issue
Block a user