13 Commits

Author SHA1 Message Date
2aa6170830 Update: microg downloading; workflow; readme.md
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
2024-05-01 12:23:22 +07:00
db4d8ea6a3 Update README.md, ReleaseNotesTemplate.md
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
2024-03-31 12:43:25 +07:00
c51bb19b8d Update workflow
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
2024-03-31 12:42:55 +07:00
096c05b8cf Update workflow scripts
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
2024-03-31 12:42:43 +07:00
82cfc6d1f6 Update Build.ps1
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
2024-03-31 12:42:25 +07:00
c4e701fc83 Update workflow
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
2024-03-10 21:22:11 +07:00
5c614ab6cd Fix indents
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
2024-03-10 21:20:13 +07:00
83310266b7 Update Actions Scripts
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
2024-03-10 21:13:28 +07:00
3381005bb2 Update Build.ps1
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
2024-03-10 21:07:28 +07:00
f26e8938d4 Revert "Update Build.yml"
This reverts commit 119c8b0e2a.
2024-03-03 19:43:50 +07:00
a9787a19a4 Revert "Update Build.ps1"
This reverts commit 75f3ea82c6.
2024-03-03 19:43:32 +07:00
119c8b0e2a Update Build.yml
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
2024-03-01 08:39:58 +07:00
75f3ea82c6 Update Build.ps1
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
2024-03-01 08:39:44 +07:00
8 changed files with 70 additions and 124 deletions

View File

@@ -10,10 +10,6 @@ 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
@@ -55,13 +51,12 @@ jobs:
--purge `
--out "Temp\revanced.apk" `
"Temp\youtube.apk"
# --resource-cache "Temp\Temp" `
- name: Create archive
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

View File

@@ -5,7 +5,7 @@
* ReVanced CLI;
* ReVanced Patches;
* ReVanced Integrations;
* microG GmsCore;
* ReVanced microG GmsCore;
* Azul Zulu.
.NOTES
@@ -18,9 +18,14 @@
# 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'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if ($Host.Version.Major -eq 5)
{
# Progress bar can significantly impact cmdlet performance
# https://github.com/PowerShell/PowerShell/issues/2138
$Script:ProgressPreference = "SilentlyContinue"
}
# Download all files to "Script location folder\ReVanced"
$WorkingFolder = Split-Path $MyInvocation.MyCommand.Path -Parent
@@ -29,56 +34,27 @@ if (-not (Test-Path -Path "$WorkingFolder\ReVanced"))
New-Item -Path "$WorkingFolder\ReVanced" -ItemType Directory -Force
}
# Get latest supported YouTube client version via ReVanced JSON
# It will let us to download always latest YouTube apk supported by ReVanced team
# https://github.com/revanced/revanced-patches/blob/main/patches.json
# Get the latest supported YouTube version to patch
# https://api.revanced.app/docs/swagger
$Parameters = @{
Uri = "https://raw.githubusercontent.com/revanced/revanced-patches/main/patches.json"
Uri = "https://api.revanced.app/v2/patches/latest"
UseBasicParsing = $true
}
$JSON = Invoke-RestMethod @Parameters
$JSON = (Invoke-RestMethod @Parameters).patches
$versions = ($JSON | Where-Object -FilterScript {$_.compatiblePackages.name -eq "com.google.android.youtube"}).compatiblePackages.versions
$LatestSupported = $versions | Sort-Object -Descending -Unique | Select-Object -First 1
$LatestSupported = $LatestSupported.replace(".", "-")
# Try to find correct NON-Bundle version
# We need a NON-bundle version
# https://apkpure.net/ru/youtube/com.google.android.youtube/versions
$Parameters = @{
Uri = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-android-apk-download/"
UseBasicParsing = $false # Disabled
Uri = "https://apkpure.net/youtube/com.google.android.youtube/download/$($LatestSupported)"
UseBasicParsing = $true
Verbose = $true
}
$URLParse = (Invoke-Webrequest @Parameters).Links.outerHTML | Where-Object -FilterScript {$_ -like "*YouTube $($LatestSupported.replace("-", ".")) (nodpi)*"}
# Check if variable contains a data
if ($URLParse)
{
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-android-apk-download/"
}
else
{
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-2-android-apk-download/"
}
$URL = (Invoke-Webrequest @Parameters).Links.href | Where-Object -FilterScript {$_ -match "APK/com.google.android.youtube"} | Select-Object -Index 1
# Get unique key to generate direct link
$Parameters = @{
Uri = $URL
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 = "$($URL)/download/$($nameProp)"
UseBasicParsing = $false # Disabled
Verbose = $true
}
$URL_Part = ((Invoke-Webrequest @Parameters).Links | Where-Object -FilterScript {$_.innerHTML -eq "here"}).href
# Replace "&amp;" with "&" to make it work
$URL_Part = $URL_Part.Replace("&amp;", "&")
# Finally, get the real link
$Parameters = @{
Uri = "https://www.apkmirror.com$URL_Part"
OutFile = "$WorkingFolder\ReVanced\youtube.apk"
UseBasicParsing = $true
Verbose = $true
@@ -91,7 +67,7 @@ $Parameters = @{
UseBasicParsing = $true
Verbose = $true
}
$URL = (Invoke-RestMethod @Parameters).assets.browser_download_url
$URL = ((Invoke-RestMethod @Parameters).assets | Where-Object -FilterScript {$_.content_type -eq "application/java-archive"}).browser_download_url
$Parameters = @{
Uri = $URL
Outfile = "$WorkingFolder\ReVanced\revanced-cli.jar"
@@ -121,7 +97,7 @@ $Parameters = @{
UseBasicParsing = $true
Verbose = $true
}
$URL = (Invoke-RestMethod @Parameters).assets.browser_download_url
$URL = ((Invoke-RestMethod @Parameters).assets | Where-Object -FilterScript {$_.content_type -eq "application/vnd.android.package-archive"}).browser_download_url
$Parameters = @{
Uri = $URL
Outfile = "$WorkingFolder\ReVanced\revanced-integrations.apk"
@@ -130,20 +106,27 @@ $Parameters = @{
}
Invoke-RestMethod @Parameters
# https://github.com/inotia00/VancedMicroG
# https://github.com/ReVanced/GmsCore
$Parameters = @{
Uri = "https://api.github.com/repos/inotia00/VancedMicroG/releases/latest"
Uri = "https://api.github.com/repos/ReVanced/GmsCore/releases/latest"
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")
@@ -187,7 +170,7 @@ Remove-Item -Path "$WorkingFolder\ReVanced\jdk_windows-x64_bin.zip" -Force
--exclude "Hide timestamp" `
--exclude "Hide seekbar" `
--purge `
--resource-cache "$WorkingFolder\ReVanced\Temp" `
--temporary-files-path "$WorkingFolder\ReVanced\Temp" `
--out "$WorkingFolder\ReVanced\revanced.apk" `
"$WorkingFolder\ReVanced\youtube.apk"

View File

@@ -9,12 +9,12 @@ Build ReVanced package (.apk) easily than ever using latest ReVanced patches and
### Locally
* To build `revanced.apk` locally you need just to run [`Build.ps1`](https://github.com/JDM170/ReVanced_Builder/blob/main/Build.ps1) via PowerShell;
* All [patches](https://github.com/revanced/revanced-patches) except the followings applied to `revanced.apk`:
* All [patches](https://revanced.app/patches?pkg=com.google.android.youtube) except the followings applied to `revanced.apk`:
* always-autorepeat
* hide-captions-button
* hide-timestamp
* hide-seekbar
* The script downloads latest available YouTube package (having parsed [JSON](https://github.com/revanced/revanced-patches/blob/main/patches.json)) supported by ReVanced Team from <https://apkmirror.com> 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 <https://apkpure.net> 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,17 +30,15 @@ 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
* [APKMirror](https://apkmirror.com)
* [APKPure](https://apkpure.net)
* [ReVanced CLI](https://github.com/revanced/revanced-cli)
* [ReVanced Patches](https://github.com/revanced/revanced-patches)
* [ReVanced Integrations](https://github.com/revanced/revanced-integrations)
* [Vanced MicroG](https://github.com/TeamVanced/VancedMicroG)
* [ReVanced MicroG](https://github.com/ReVanced/GmsCore)
* [AngleSharp](https://github.com/AngleSharp/AngleSharp)
* [Zulu JDK](https://github.com/ScoopInstaller/Java)
* [Sophia Telegram chat](https://t.me/sophia_chat)

View File

@@ -4,5 +4,5 @@
* ReVanced CLI CLITag;
* ReVanced Patches PatchesTag;
* ReVanced Integrations IntegrationsTag;
* Vanced MicroG MicroGTag;
* ReVanced MicroG MicroGTag;
* Azul Zulu ZuluTag.

View File

@@ -1,18 +1,24 @@
# https://github.com/inotia00/VancedMicroG
# https://github.com/ReVanced/GmsCore
$Parameters = @{
Uri = "https://api.github.com/repos/inotia00/VancedMicroG/releases/latest"
Uri = "https://api.github.com/repos/ReVanced/GmsCore/releases/latest"
UseBasicParsing = $true
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

View File

@@ -5,7 +5,7 @@ $Parameters = @{
Verbose = $true
}
$apiResult = Invoke-RestMethod @Parameters
$URL = $apiResult.assets.browser_download_url
$URL = ($apiResult.assets | Where-Object -FilterScript {$_.content_type -eq "application/java-archive"}).browser_download_url
$TAG = $apiResult.tag_name
$Parameters = @{
Uri = $URL

View File

@@ -5,7 +5,7 @@ $Parameters = @{
Verbose = $true
}
$apiResult = Invoke-RestMethod @Parameters
$URL = $apiResult.assets.browser_download_url
$URL = ($apiResult.assets | Where-Object -FilterScript {$_.content_type -eq "application/vnd.android.package-archive"}).browser_download_url
$TAG = $apiResult.tag_name
$Parameters = @{
Uri = $URL

View File

@@ -1,60 +1,24 @@
# Get latest supported YouTube client version via ReVanced JSON
# It will let us to download always latest YouTube apk supported by ReVanced team
# https://github.com/revanced/revanced-patches/blob/main/patches.json
# Get the latest supported YouTube version to patch
# https://api.revanced.app/docs/swagger
$Parameters = @{
Uri = "https://raw.githubusercontent.com/revanced/revanced-patches/main/patches.json"
Uri = "https://api.revanced.app/v2/patches/latest"
UseBasicParsing = $true
}
$JSON = Invoke-RestMethod @Parameters
$JSON = (Invoke-RestMethod @Parameters).patches
$versions = ($JSON | Where-Object -FilterScript {$_.compatiblePackages.name -eq "com.google.android.youtube"}).compatiblePackages.versions
$LatestSupported = $versions | Sort-Object -Descending -Unique | Select-Object -First 1
$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
# Create parser object
$angleparser = New-Object -TypeName AngleSharp.Html.Parser.HtmlParser
# Try to find correct NON-Bundle version
# We need a NON-bundle version
# https://apkpure.net/ru/youtube/com.google.android.youtube/versions
$Parameters = @{
Uri = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupportedYT)-release/youtube-$($LatestSupportedYT)-android-apk-download/"
UseBasicParsing = $false # Disabled
Verbose = $true
}
$URLParse = (Invoke-Webrequest @Parameters).Links.outerHTML | Where-Object -FilterScript {$_ -like "*YouTube $($LatestSupported) (nodpi)*"}
# Check if variable contains a data
if ($URLParse)
{
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupportedYT)-release/youtube-$($LatestSupportedYT)-android-apk-download/"
}
else
{
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupportedYT)-release/youtube-$($LatestSupportedYT)-2-android-apk-download/"
}
# Get unique key to generate direct link
$Parameters = @{
Uri = $URL
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 = "$($URL)/download/$($Key)"
Uri = "https://apkpure.net/youtube/com.google.android.youtube/download/$($LatestSupported)"
UseBasicParsing = $true
Verbose = $true
}
$Request = Invoke-Webrequest @Parameters
$Parsed = $angleparser.ParseDocument($Request.Content)
$Key = ($Parsed.All | Where-Object -FilterScript { $_.InnerHtml -eq "here" }).Search
$URL = (Invoke-Webrequest @Parameters).Links.href | Where-Object -FilterScript {$_ -match "APK/com.google.android.youtube"} | Select-Object -Index 1
# Finally, get the real link
$Parameters = @{
Uri = "https://www.apkmirror.com/wp-content/themes/APKMirror/download.php$Key"
Uri = $URL
OutFile = "Temp\youtube.apk"
UseBasicParsing = $true
Verbose = $true