mirror of
https://github.com/JDM170/ReVanced_Builder
synced 2025-11-29 14:41:46 +07:00
Compare commits
4 Commits
2024.04.01
...
2024.09.01
| Author | SHA1 | Date | |
|---|---|---|---|
|
4905811659
|
|||
|
4758eb22cf
|
|||
|
c3c0a74bfe
|
|||
|
2aa6170830
|
6
.github/workflows/Build.yml
vendored
6
.github/workflows/Build.yml
vendored
@@ -10,6 +10,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
|
||||
- name: Install AngleSharp
|
||||
run: |
|
||||
Install-Package AngleSharp -Source https://www.nuget.org/api/v2 -SkipDependencies -Force
|
||||
|
||||
- name: Download YouTube
|
||||
run: |
|
||||
New-Item -Path Temp -ItemType Directory -Force
|
||||
@@ -56,7 +60,7 @@ jobs:
|
||||
run: |
|
||||
Get-ChildItem Temp\Temp -Recurse -Force
|
||||
$Parameters = @{
|
||||
Path = "Temp\revanced.apk", "Temp\microg.apk"
|
||||
Path = "Temp\revanced.apk", "Temp\microg.apk", "Temp\microg-hw.apk"
|
||||
DestinationPath = "ReVanced.zip"
|
||||
CompressionLevel = "Fastest"
|
||||
Force = $true
|
||||
|
||||
70
Build.ps1
70
Build.ps1
@@ -45,6 +45,7 @@ $versions = ($JSON | Where-Object -FilterScript {$_.compatiblePackages.name -eq
|
||||
$LatestSupported = $versions | Sort-Object -Descending -Unique | Select-Object -First 1
|
||||
|
||||
# We need a NON-bundle version
|
||||
<#
|
||||
# https://apkpure.net/ru/youtube/com.google.android.youtube/versions
|
||||
$Parameters = @{
|
||||
Uri = "https://apkpure.net/youtube/com.google.android.youtube/download/$($LatestSupported)"
|
||||
@@ -60,6 +61,54 @@ $Parameters = @{
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-Webrequest @Parameters
|
||||
#>
|
||||
|
||||
# https://www.apkmirror.com/apk/google-inc/youtube/
|
||||
$apkMirrorLink = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported.replace('.', '-'))-release/"
|
||||
$Parameters = @{
|
||||
Uri = $apkMirrorLink
|
||||
UseBasicParsing = $false # Disabled
|
||||
Verbose = $true
|
||||
}
|
||||
$Request = Invoke-Webrequest @Parameters
|
||||
$Request.ParsedHtml.getElementsByClassName("table-row headerFont") | ForEach-Object -Process {
|
||||
foreach ($child in $_.children)
|
||||
{
|
||||
if ($child.innerText -eq "nodpi")
|
||||
{
|
||||
$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
|
||||
Verbose = $true
|
||||
}
|
||||
$Request = Invoke-Webrequest @Parameters
|
||||
$nameProp = $Request.ParsedHtml.getElementsByClassName("accent_bg btn btn-flat downloadButton") | ForEach-Object -Process {$_.nameProp}
|
||||
|
||||
$Parameters = @{
|
||||
Uri = $apkMirrorLink + "/download/$($nameProp)"
|
||||
UseBasicParsing = $false # Disabled
|
||||
Verbose = $true
|
||||
}
|
||||
$URL_Part = ((Invoke-Webrequest @Parameters).Links | Where-Object -FilterScript {$_.innerHTML -eq "here"}).href
|
||||
# Replace "&" with "&" to make it work
|
||||
$URL_Part = $URL_Part.Replace("&", "&")
|
||||
|
||||
# Finally, get the real link
|
||||
$Parameters = @{
|
||||
Uri = "https://www.apkmirror.com$URL_Part"
|
||||
OutFile = "$WorkingFolder\ReVanced\youtube.apk"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-Webrequest @Parameters
|
||||
|
||||
# https://github.com/revanced/revanced-cli
|
||||
$Parameters = @{
|
||||
@@ -112,14 +161,21 @@ $Parameters = @{
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
$URL = (Invoke-RestMethod @Parameters).assets.browser_download_url
|
||||
$Parameters = @{
|
||||
Uri = $URL
|
||||
Outfile = "$WorkingFolder\ReVanced\microg.apk"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
$URL = (Invoke-RestMethod @Parameters).assets
|
||||
foreach($url in $URL) {
|
||||
if ($url.name.Contains("-hw-")) {
|
||||
$url.name = "microg-hw.apk"
|
||||
} else {
|
||||
$url.name = "microg.apk"
|
||||
}
|
||||
$Parameters = @{
|
||||
Uri = $url.browser_download_url
|
||||
Outfile = "$WorkingFolder\ReVanced\$($url.name)"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-RestMethod @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")
|
||||
|
||||
@@ -14,7 +14,7 @@ Build ReVanced package (.apk) easily than ever using latest ReVanced patches and
|
||||
* hide-captions-button
|
||||
* hide-timestamp
|
||||
* hide-seekbar
|
||||
* The script downloads latest available YouTube package (having parsed [ReVanced API](https://api.revanced.app/v2/patches/latest)) supported by ReVanced Team from <https://apkpure.net> and all dependencies and build package using [Zulu JDK](https://www.azul.com/downloads/?package=jdk);
|
||||
* The script downloads latest available YouTube package (having parsed [ReVanced API](https://api.revanced.app/v2/patches/latest)) supported by ReVanced Team from [APKMirror](https://apkmirror.com) and all dependencies and build package using [Zulu JDK](https://www.azul.com/downloads/?package=jdk);
|
||||
* Script installs no apps — everything will be held in your `Script location folder\ReVanced`;
|
||||
* After compiling you get `revanced.apk` & `microg.apk` ready to be installed;
|
||||
* Release notes are generated dynamically using the [ReleaseNotesTemplate.md](https://github.com/JDM170/ReVanced_Builder/blob/main/ReleaseNotesTemplate.md) template.
|
||||
@@ -30,13 +30,12 @@ Trigger the [`Build`](https://github.com/JDM170/ReVanced_Builder/actions/workflo
|
||||
## Requirements if you compile locally
|
||||
|
||||
* Windows 10 x64 or Windows 11
|
||||
* Windows PowerShell 5.1
|
||||
* PowerShell 7 won't work due to it doesn't contain Trident HTML parser, so I have to use a 3rd party parser [AngleSharp](https://github.com/AngleSharp/AngleSharp);
|
||||
* If you still want it, [get](https://github.com/JDM170/ReVanced_Builder/blob/main/.github/workflows/Build.yml) code from Actions (it's run in PowerShell 7).
|
||||
* Windows PowerShell 5.1/7
|
||||
|
||||
## Links
|
||||
|
||||
* [APKPure](https://apkpure.net)
|
||||
* [APKMirror](https://apkmirror.com)
|
||||
* [ReVanced CLI](https://github.com/revanced/revanced-cli)
|
||||
* [ReVanced Patches](https://github.com/revanced/revanced-patches)
|
||||
* [ReVanced Integrations](https://github.com/revanced/revanced-integrations)
|
||||
|
||||
@@ -5,14 +5,20 @@ $Parameters = @{
|
||||
Verbose = $true
|
||||
}
|
||||
$apiResult = Invoke-RestMethod @Parameters
|
||||
$URL = $apiResult.assets.browser_download_url
|
||||
$TAG = $apiResult.tag_name
|
||||
$Parameters = @{
|
||||
Uri = $URL
|
||||
Outfile = "Temp\microg.apk"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
foreach($url in $apiResult.assets) {
|
||||
if ($url.name.Contains("-hw-")) {
|
||||
$url.name = "microg-hw.apk"
|
||||
} else {
|
||||
$url.name = "microg.apk"
|
||||
}
|
||||
$Parameters = @{
|
||||
Uri = $url.browser_download_url
|
||||
Outfile = "Temp\$($url.name)"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-RestMethod @Parameters
|
||||
}
|
||||
Invoke-RestMethod @Parameters
|
||||
|
||||
echo "MicroGTag=$TAG" >> $env:GITHUB_ENV
|
||||
|
||||
@@ -10,6 +10,7 @@ $LatestSupported = $versions | Sort-Object -Descending -Unique | Select-Object -
|
||||
|
||||
# We need a NON-bundle version
|
||||
# https://apkpure.net/ru/youtube/com.google.android.youtube/versions
|
||||
<#
|
||||
$Parameters = @{
|
||||
Uri = "https://apkpure.net/youtube/com.google.android.youtube/download/$($LatestSupported)"
|
||||
UseBasicParsing = $true
|
||||
@@ -24,5 +25,62 @@ $Parameters = @{
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-Webrequest @Parameters
|
||||
#>
|
||||
|
||||
$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
|
||||
|
||||
# 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.replace('.', '-'))-release/"
|
||||
$Parameters = @{
|
||||
Uri = $apkMirrorLink
|
||||
UseBasicParsing = $false # Disabled
|
||||
Verbose = $true
|
||||
}
|
||||
$Request = Invoke-Webrequest @Parameters
|
||||
$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 = @{
|
||||
Uri = $apkMirrorLink + "download/$($Key)"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
$Request = Invoke-Webrequest @Parameters
|
||||
$Parsed = $angleparser.ParseDocument($Request.Content)
|
||||
$Key = ($Parsed.All | Where-Object -FilterScript { $_.InnerHtml -eq "here" }).Search
|
||||
|
||||
# Finally, get the real link
|
||||
$Parameters = @{
|
||||
Uri = "https://www.apkmirror.com/wp-content/themes/APKMirror/download.php$Key"
|
||||
OutFile = "Temp\youtube.apk"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-Webrequest @Parameters
|
||||
|
||||
echo "LatestSupportedYT=$LatestSupported" >> $env:GITHUB_ENV
|
||||
|
||||
Reference in New Issue
Block a user