Upload files
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
80
.github/workflows/Build.yml
vendored
Normal file
80
.github/workflows/Build.yml
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
patch:
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 5
|
||||
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
|
||||
|
||||
. Scripts\YouTube.ps1
|
||||
|
||||
- name: Download ReVanced CLI
|
||||
run: |
|
||||
. Scripts\ReVanced_CLI.ps1
|
||||
|
||||
- name: Download ReVanced Patches
|
||||
run: |
|
||||
. Scripts\ReVanced_Patches.ps1
|
||||
|
||||
- name: Download Vanced MicroG
|
||||
run: |
|
||||
. Scripts\MicroG.ps1
|
||||
|
||||
- name: Download and expanding Zulu JDK
|
||||
run: |
|
||||
. Scripts\Zulu_JDK.ps1
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
$JavaPath = (Resolve-Path -Path "Temp\jdk_windows-x64_bin\zulu*win_x64\bin\java.exe").Path
|
||||
|
||||
& $JavaPath `
|
||||
-jar "Temp\revanced-cli.jar" patch `
|
||||
--patches "Temp\revanced-patches.rvp" `
|
||||
--disable "Always repeat" `
|
||||
--disable "Disable auto captions" `
|
||||
--disable "Hide timestamp" `
|
||||
--disable "Hide seekbar" `
|
||||
--purge `
|
||||
--out "Temp\revanced.apk" `
|
||||
"Temp\youtube.apk"
|
||||
|
||||
- name: Create archive
|
||||
run: |
|
||||
Get-ChildItem Temp\Temp -Recurse -Force
|
||||
$Parameters = @{
|
||||
Path = "Temp\revanced.apk", "Temp\microg.apk", "Temp\microg-hw.apk"
|
||||
DestinationPath = "ReVanced.zip"
|
||||
CompressionLevel = "Fastest"
|
||||
Force = $true
|
||||
}
|
||||
Compress-Archive @Parameters
|
||||
|
||||
- name: Create Release Notes
|
||||
id: read_release
|
||||
run: |
|
||||
# https://en.wikipedia.org/wiki/Percent-encoding
|
||||
(Get-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Raw).replace("YouTubeTag", "${{ env.LatestSupportedYT }}").replace("CLITag", "${{ env.CLIvtag }}").replace("PatchesTag", "${{ env.Patchesvtag }}").replace("MicroGTag", "${{ env.MicroGTag }}").replace("ZuluTag", "${{ env.ZuluTag }}") | Set-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Force
|
||||
# https://trstringer.com/github-actions-multiline-strings/
|
||||
Add-Content -Path $env:GITHUB_OUTPUT -Value "ReleaseBody=ReleaseNotesTemplate.md"
|
||||
$ReleaseName = Get-Date -f "yyyy.MM.dd"
|
||||
echo "RELEASE_NAME=$ReleaseName" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Upload to Releases
|
||||
uses: softprops/action-gh-release@v2.2.1
|
||||
with:
|
||||
tag_name: ${{ env.RELEASE_NAME }}
|
||||
body_path: ${{ steps.read_release.outputs.ReleaseBody }}
|
||||
files: ReVanced.zip
|
||||
236
Build.ps1
Normal file
236
Build.ps1
Normal file
@@ -0,0 +1,236 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Build ReVanced app using latest components:
|
||||
* YouTube (latest supported);
|
||||
* ReVanced CLI;
|
||||
* ReVanced Patches;
|
||||
* ReVanced Integrations;
|
||||
* ReVanced microG GmsCore;
|
||||
* Azul Zulu.
|
||||
|
||||
.NOTES
|
||||
After compiling, microg.apk and compiled revanced.apk will be located in "Script location folder folder\ReVanced"
|
||||
|
||||
.LINKS
|
||||
https://github.com/revanced
|
||||
#>
|
||||
|
||||
# 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
|
||||
|
||||
[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"
|
||||
$CurrentFolder = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
if (-not (Test-Path -Path "$CurrentFolder\ReVanced"))
|
||||
{
|
||||
New-Item -Path "$CurrentFolder\ReVanced" -ItemType Directory -Force
|
||||
}
|
||||
|
||||
# Get the latest supported YouTube version to patch
|
||||
# https://api.revanced.app
|
||||
$Parameters = @{
|
||||
Uri = "https://api.revanced.app/v4/patches/list"
|
||||
UseBasicParsing = $true
|
||||
}
|
||||
$JSON = (Invoke-Webrequest @Parameters).Content | ConvertFrom-Json
|
||||
$versions = ($JSON | Where-Object -FilterScript {$_.name -eq "Video ads"})
|
||||
$LatestSupported = $versions.compatiblePackages.'com.google.android.youtube' | Sort-Object -Descending -Unique | Select-Object -First 1
|
||||
|
||||
Write-Verbose -Message "" -Verbose
|
||||
Write-Verbose -Message "Downloading the latest supported YouTube apk" -Verbose
|
||||
|
||||
# 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
|
||||
Verbose = $true
|
||||
}
|
||||
$URL = (Invoke-Webrequest @Parameters).Links.href | Where-Object -FilterScript {$_ -match "APK/com.google.android.youtube"} | Select-Object -Index 1
|
||||
|
||||
$Parameters = @{
|
||||
Uri = $URL
|
||||
OutFile = "$CurrentFolder\ReVanced\youtube.apk"
|
||||
UseBasicParsing = $true
|
||||
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 = "$CurrentFolder\ReVanced\youtube.apk"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-Webrequest @Parameters
|
||||
|
||||
Write-Verbose -Message "" -Verbose
|
||||
Write-Verbose -Message "Downloading ReVanced CLI" -Verbose
|
||||
# https://github.com/revanced/revanced-cli
|
||||
$Parameters = @{
|
||||
Uri = "https://api.github.com/repos/revanced/revanced-cli/releases/latest"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
$URL = ((Invoke-RestMethod @Parameters).assets | Where-Object -FilterScript {$_.content_type -eq "application/java-archive"}).browser_download_url
|
||||
$Parameters = @{
|
||||
Uri = $URL
|
||||
Outfile = "$CurrentFolder\ReVanced\revanced-cli.jar"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-RestMethod @Parameters
|
||||
|
||||
Write-Verbose -Message "" -Verbose
|
||||
Write-Verbose -Message "Downloading ReVanced patches" -Verbose
|
||||
# https://github.com/revanced/revanced-patches
|
||||
$Parameters = @{
|
||||
Uri = "https://api.github.com/repos/revanced/revanced-patches/releases/latest"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
$URL = ((Invoke-RestMethod @Parameters).assets | Where-Object -FilterScript {$_.content_type -eq "text/plain"}).browser_download_url
|
||||
$Parameters = @{
|
||||
Uri = $URL
|
||||
Outfile = "$CurrentFolder\ReVanced\revanced-patches.rvp"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-RestMethod @Parameters
|
||||
|
||||
Write-Verbose -Message "" -Verbose
|
||||
Write-Verbose -Message "Downloading ReVanced GmsCore" -Verbose
|
||||
# https://github.com/ReVanced/GmsCore
|
||||
$Parameters = @{
|
||||
Uri = "https://api.github.com/repos/ReVanced/GmsCore/releases/latest"
|
||||
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 = "$CurrentFolder\ReVanced\$($url.name)"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-RestMethod @Parameters
|
||||
}
|
||||
|
||||
# Sometimes older version of zulu-jdk causes conflict, so remove older version before proceeding.
|
||||
if (Test-Path -Path "$CurrentFolder\ReVanced\jdk")
|
||||
{
|
||||
Remove-Item -Path "$CurrentFolder\ReVanced\jdk" -Recurse -Force
|
||||
}
|
||||
|
||||
Write-Verbose -Message "" -Verbose
|
||||
Write-Verbose -Message "Downloading Azul Zulu" -Verbose
|
||||
# https://github.com/ScoopInstaller/Java/blob/master/bucket/zulu-jdk.json
|
||||
$Parameters = @{
|
||||
Uri = "https://raw.githubusercontent.com/ScoopInstaller/Java/master/bucket/zulu-jdk.json"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
$URL = (Invoke-RestMethod @Parameters).architecture."64bit".url
|
||||
$Parameters = @{
|
||||
Uri = $URL
|
||||
Outfile = "$CurrentFolder\ReVanced\jdk_windows-x64_bin.zip"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-RestMethod @Parameters
|
||||
|
||||
# Expand jdk_windows-x64_bin archive
|
||||
$Parameters = @{
|
||||
Path = "$CurrentFolder\ReVanced\jdk_windows-x64_bin.zip"
|
||||
DestinationPath = "$CurrentFolder\ReVanced\jdk"
|
||||
Force = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Expand-Archive @Parameters
|
||||
|
||||
Remove-Item -Path "$CurrentFolder\ReVanced\jdk_windows-x64_bin.zip" -Force
|
||||
|
||||
# Let's create patched APK
|
||||
& "$CurrentFolder\ReVanced\jdk\zulu*win_x64\bin\java.exe" `
|
||||
-jar "$CurrentFolder\ReVanced\revanced-cli.jar" patch `
|
||||
--patches "$CurrentFolder\ReVanced\revanced-patches.rvp" `
|
||||
--disable "Always repeat" `
|
||||
--disable "Disable auto captions" `
|
||||
--disable "Hide timestamp" `
|
||||
--disable "Hide seekbar" `
|
||||
--purge `
|
||||
--temporary-files-path "$CurrentFolder\ReVanced\Temp" `
|
||||
--out "$CurrentFolder\ReVanced\revanced.apk" `
|
||||
"$CurrentFolder\ReVanced\youtube.apk"
|
||||
|
||||
# Open working directory with builded files
|
||||
# Invoke-Item -Path "$CurrentFolder\ReVanced"
|
||||
|
||||
# Remove temp directory, because cli failed to clean up directory
|
||||
# Remove-Item -Path "$CurrentFolder\ReVanced\Temp" -Recurse -Force -Confirm:$false
|
||||
|
||||
$Files = @(
|
||||
"$CurrentFolder\ReVanced\Temp",
|
||||
"$CurrentFolder\ReVanced\jdk",
|
||||
"$CurrentFolder\ReVanced\revanced-cli.jar",
|
||||
"$CurrentFolder\ReVanced\revanced-patches.rvp",
|
||||
"$CurrentFolder\ReVanced\youtube.apk"
|
||||
)
|
||||
Remove-Item -Path $Files -Recurse -Force
|
||||
|
||||
Write-Warning -Message "Latest available revanced.apk & microg.apk are ready in `"$CurrentFolder\ReVanced`""
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Dmitry Nefedov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
45
README.md
Normal file
45
README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
<a href="https://github.com/JDM170/ReVanced_Builder/actions"><img src="https://img.shields.io/github/actions/workflow/status/JDM170/ReVanced_Builder/Build.yml?label=GitHub%20Actions&logo=GitHub"></a>
|
||||
|
||||
# ReVanced builder
|
||||
|
||||
Build ReVanced package (.apk) easily than ever using latest ReVanced patches and dependencies locally or via cloud
|
||||
|
||||
## Usage
|
||||
|
||||
### 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://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 [ReVanced API](https://api.revanced.app/v4/patches/list)) 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.
|
||||
|
||||
### By using CI/CD
|
||||
|
||||
Trigger the [`Build`](https://github.com/JDM170/ReVanced_Builder/actions/workflows/Build.yml) action manually to create [release page](https://github.com/JDM170/ReVanced_Builder/releases/latest) with configured release notes showing dependencies used for building.
|
||||
|
||||

|
||||
|
||||
`ReVanced.zip` will contain a built `revanced.apk` & latest `microg.apk`.
|
||||
|
||||
## Requirements if you compile locally
|
||||
|
||||
* Windows 10 x64 or Windows 11
|
||||
* Windows PowerShell 5.1
|
||||
* if you want to use PowerShell 7, you will have to install a 3rd party HTML parser ([AngleSharp](https://github.com/AngleSharp/AngleSharp))
|
||||
|
||||
## 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 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)
|
||||
7
ReleaseNotesTemplate.md
Normal file
7
ReleaseNotesTemplate.md
Normal file
@@ -0,0 +1,7 @@
|
||||
## Automatically generated release notes
|
||||
|
||||
* YouTube YouTubeTag;
|
||||
* ReVanced CLI CLITag;
|
||||
* ReVanced Patches PatchesTag;
|
||||
* ReVanced MicroG MicroGTag;
|
||||
* Azul Zulu ZuluTag.
|
||||
24
Scripts/MicroG.ps1
Normal file
24
Scripts/MicroG.ps1
Normal file
@@ -0,0 +1,24 @@
|
||||
# https://github.com/ReVanced/GmsCore
|
||||
$Parameters = @{
|
||||
Uri = "https://api.github.com/repos/ReVanced/GmsCore/releases/latest"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
$apiResult = Invoke-RestMethod @Parameters
|
||||
$TAG = $apiResult.tag_name
|
||||
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
|
||||
}
|
||||
|
||||
echo "MicroGTag=$TAG" >> $env:GITHUB_ENV
|
||||
18
Scripts/ReVanced_CLI.ps1
Normal file
18
Scripts/ReVanced_CLI.ps1
Normal file
@@ -0,0 +1,18 @@
|
||||
# https://github.com/revanced/revanced-cli
|
||||
$Parameters = @{
|
||||
Uri = "https://api.github.com/repos/revanced/revanced-cli/releases/latest"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
$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 = $URL
|
||||
Outfile = "Temp\revanced-cli.jar"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-RestMethod @Parameters
|
||||
|
||||
echo "CLIvtag=$TAG" >> $env:GITHUB_ENV
|
||||
18
Scripts/ReVanced_Patches.ps1
Normal file
18
Scripts/ReVanced_Patches.ps1
Normal file
@@ -0,0 +1,18 @@
|
||||
# https://github.com/revanced/revanced-patches
|
||||
$Parameters = @{
|
||||
Uri = "https://api.github.com/repos/revanced/revanced-patches/releases/latest"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
$apiResult = Invoke-RestMethod @Parameters
|
||||
$URL = ($apiResult.assets | Where-Object -FilterScript {$_.content_type -eq "text/plain"}).browser_download_url
|
||||
$TAG = $apiResult.tag_name
|
||||
$Parameters = @{
|
||||
Uri = $URL
|
||||
Outfile = "Temp\revanced-patches.rvp"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-RestMethod @Parameters
|
||||
|
||||
echo "Patchesvtag=$TAG" >> $env:GITHUB_ENV
|
||||
86
Scripts/YouTube.ps1
Normal file
86
Scripts/YouTube.ps1
Normal file
@@ -0,0 +1,86 @@
|
||||
# Get the latest supported YouTube version to patch
|
||||
# https://api.revanced.app/docs/swagger
|
||||
$Parameters = @{
|
||||
Uri = "https://api.revanced.app/v4/patches/list"
|
||||
UseBasicParsing = $true
|
||||
}
|
||||
$JSON = (Invoke-Webrequest @Parameters).Content | ConvertFrom-Json
|
||||
$versions = ($JSON | Where-Object -FilterScript {$_.name -eq "Video ads"})
|
||||
$LatestSupported = $versions.compatiblePackages.'com.google.android.youtube' | 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)"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
$URL = (Invoke-Webrequest @Parameters).Links.href | Where-Object -FilterScript {$_ -match "APK/com.google.android.youtube"} | Select-Object -Index 1
|
||||
|
||||
$Parameters = @{
|
||||
Uri = $URL
|
||||
OutFile = "Temp\youtube.apk"
|
||||
UseBasicParsing = $true
|
||||
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
|
||||
30
Scripts/Zulu_JDK.ps1
Normal file
30
Scripts/Zulu_JDK.ps1
Normal file
@@ -0,0 +1,30 @@
|
||||
# https://github.com/ScoopInstaller/Java/blob/master/bucket/zulu-jdk.json
|
||||
$Parameters = @{
|
||||
Uri = "https://raw.githubusercontent.com/ScoopInstaller/Java/master/bucket/zulu-jdk.json"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
$apiResult = Invoke-RestMethod @Parameters
|
||||
$URL = $apiResult.architecture."64bit".url
|
||||
$TAG = $apiResult.version
|
||||
$Parameters = @{
|
||||
Uri = $URL
|
||||
Outfile = "Temp\jdk_windows-x64_bin.zip"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Invoke-RestMethod @Parameters
|
||||
|
||||
echo "ZuluTag=$TAG" >> $env:GITHUB_ENV
|
||||
|
||||
Write-Verbose -Message "Expanding Zulu JDK" -Verbose
|
||||
|
||||
$Parameters = @{
|
||||
Path = "Temp\jdk_windows-x64_bin.zip"
|
||||
DestinationPath = "Temp\jdk_windows-x64_bin"
|
||||
Force = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Expand-Archive @Parameters
|
||||
|
||||
Remove-Item -Path "Temp\jdk_windows-x64_bin.zip" -Force
|
||||
Reference in New Issue
Block a user