mirror of
https://github.com/JDM170/ReVanced_Builder
synced 2025-11-29 14:41:46 +07:00
Compare commits
19 Commits
2024.01.02
...
2024.11.01
| Author | SHA1 | Date | |
|---|---|---|---|
|
4905811659
|
|||
|
4758eb22cf
|
|||
|
c3c0a74bfe
|
|||
|
2aa6170830
|
|||
|
db4d8ea6a3
|
|||
|
c51bb19b8d
|
|||
|
096c05b8cf
|
|||
|
82cfc6d1f6
|
|||
|
c4e701fc83
|
|||
|
5c614ab6cd
|
|||
|
83310266b7
|
|||
|
3381005bb2
|
|||
|
f26e8938d4
|
|||
|
a9787a19a4
|
|||
|
119c8b0e2a
|
|||
|
75f3ea82c6
|
|||
|
63e95a3a63
|
|||
|
a61a5fbb8a
|
|||
|
f10c8abf4e
|
11
.github/workflows/Build.yml
vendored
11
.github/workflows/Build.yml
vendored
@@ -48,12 +48,11 @@ jobs:
|
|||||||
-jar "Temp\revanced-cli.jar" patch `
|
-jar "Temp\revanced-cli.jar" patch `
|
||||||
--patch-bundle "Temp\revanced-patches.jar" `
|
--patch-bundle "Temp\revanced-patches.jar" `
|
||||||
--merge "Temp\revanced-integrations.apk" `
|
--merge "Temp\revanced-integrations.apk" `
|
||||||
--exclude "always-autorepeat" `
|
--exclude "Always repeat" `
|
||||||
--exclude "hide-captions-button" `
|
--exclude "Hide captions button" `
|
||||||
--exclude "hide-timestamp" `
|
--exclude "Hide timestamp" `
|
||||||
--exclude "hide-seekbar" `
|
--exclude "Hide seekbar" `
|
||||||
--purge `
|
--purge `
|
||||||
--resource-cache "Temp\Temp" `
|
|
||||||
--out "Temp\revanced.apk" `
|
--out "Temp\revanced.apk" `
|
||||||
"Temp\youtube.apk"
|
"Temp\youtube.apk"
|
||||||
|
|
||||||
@@ -61,7 +60,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
Get-ChildItem Temp\Temp -Recurse -Force
|
Get-ChildItem Temp\Temp -Recurse -Force
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Path = "Temp\revanced.apk", "Temp\microg.apk"
|
Path = "Temp\revanced.apk", "Temp\microg.apk", "Temp\microg-hw.apk"
|
||||||
DestinationPath = "ReVanced.zip"
|
DestinationPath = "ReVanced.zip"
|
||||||
CompressionLevel = "Fastest"
|
CompressionLevel = "Fastest"
|
||||||
Force = $true
|
Force = $true
|
||||||
|
|||||||
110
Build.ps1
110
Build.ps1
@@ -5,7 +5,7 @@
|
|||||||
* ReVanced CLI;
|
* ReVanced CLI;
|
||||||
* ReVanced Patches;
|
* ReVanced Patches;
|
||||||
* ReVanced Integrations;
|
* ReVanced Integrations;
|
||||||
* microG GmsCore;
|
* ReVanced microG GmsCore;
|
||||||
* Azul Zulu.
|
* Azul Zulu.
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
@@ -18,9 +18,14 @@
|
|||||||
# Requires -Version 5.1
|
# 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
|
# 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.
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
# Ref: https://www.codewrecks.com/post/azdo/pills/powershell-download/
|
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
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"
|
# Download all files to "Script location folder\ReVanced"
|
||||||
$WorkingFolder = Split-Path $MyInvocation.MyCommand.Path -Parent
|
$WorkingFolder = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||||
@@ -29,38 +34,58 @@ if (-not (Test-Path -Path "$WorkingFolder\ReVanced"))
|
|||||||
New-Item -Path "$WorkingFolder\ReVanced" -ItemType Directory -Force
|
New-Item -Path "$WorkingFolder\ReVanced" -ItemType Directory -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get latest supported YouTube client version via ReVanced JSON
|
# Get the latest supported YouTube version to patch
|
||||||
# It will let us to download always latest YouTube apk supported by ReVanced team
|
# https://api.revanced.app/docs/swagger
|
||||||
# https://github.com/revanced/revanced-patches/blob/main/patches.json
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "https://raw.githubusercontent.com/revanced/revanced-patches/main/patches.json"
|
Uri = "https://api.revanced.app/v2/patches/latest"
|
||||||
UseBasicParsing = $true
|
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
|
$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 = $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 = @{
|
$Parameters = @{
|
||||||
Uri = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-android-apk-download/"
|
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 = "$WorkingFolder\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
|
UseBasicParsing = $false # Disabled
|
||||||
Verbose = $true
|
Verbose = $true
|
||||||
}
|
}
|
||||||
$URLParse = (Invoke-Webrequest @Parameters).Links.outerHTML | Where-Object -FilterScript {$_ -like "*YouTube $($LatestSupported.replace("-", ".")) (nodpi)*"}
|
$Request = Invoke-Webrequest @Parameters
|
||||||
# Check if variable contains a data
|
$Request.ParsedHtml.getElementsByClassName("table-row headerFont") | ForEach-Object -Process {
|
||||||
if ($URLParse)
|
foreach ($child in $_.children)
|
||||||
{
|
{
|
||||||
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-android-apk-download/"
|
if ($child.innerText -eq "nodpi")
|
||||||
}
|
{
|
||||||
else
|
$apkPackageLink = ($_.getElementsByTagName("a") | Select-Object -First 1).nameProp
|
||||||
{
|
break
|
||||||
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-2-android-apk-download/"
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$apkMirrorLink += $apkPackageLink # actual APK link (not BUNDLE)
|
||||||
|
|
||||||
# Get unique key to generate direct link
|
# Get unique key to generate direct link
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $URL
|
Uri = $apkMirrorLink
|
||||||
UseBasicParsing = $false # Disabled
|
UseBasicParsing = $false # Disabled
|
||||||
Verbose = $true
|
Verbose = $true
|
||||||
}
|
}
|
||||||
@@ -68,7 +93,7 @@ $Request = Invoke-Webrequest @Parameters
|
|||||||
$nameProp = $Request.ParsedHtml.getElementsByClassName("accent_bg btn btn-flat downloadButton") | ForEach-Object -Process {$_.nameProp}
|
$nameProp = $Request.ParsedHtml.getElementsByClassName("accent_bg btn btn-flat downloadButton") | ForEach-Object -Process {$_.nameProp}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$($URL)/download/$($nameProp)"
|
Uri = $apkMirrorLink + "/download/$($nameProp)"
|
||||||
UseBasicParsing = $false # Disabled
|
UseBasicParsing = $false # Disabled
|
||||||
Verbose = $true
|
Verbose = $true
|
||||||
}
|
}
|
||||||
@@ -91,7 +116,7 @@ $Parameters = @{
|
|||||||
UseBasicParsing = $true
|
UseBasicParsing = $true
|
||||||
Verbose = $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 = @{
|
$Parameters = @{
|
||||||
Uri = $URL
|
Uri = $URL
|
||||||
Outfile = "$WorkingFolder\ReVanced\revanced-cli.jar"
|
Outfile = "$WorkingFolder\ReVanced\revanced-cli.jar"
|
||||||
@@ -121,7 +146,7 @@ $Parameters = @{
|
|||||||
UseBasicParsing = $true
|
UseBasicParsing = $true
|
||||||
Verbose = $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 = @{
|
$Parameters = @{
|
||||||
Uri = $URL
|
Uri = $URL
|
||||||
Outfile = "$WorkingFolder\ReVanced\revanced-integrations.apk"
|
Outfile = "$WorkingFolder\ReVanced\revanced-integrations.apk"
|
||||||
@@ -130,20 +155,27 @@ $Parameters = @{
|
|||||||
}
|
}
|
||||||
Invoke-RestMethod @Parameters
|
Invoke-RestMethod @Parameters
|
||||||
|
|
||||||
# https://github.com/TeamVanced/VancedMicroG
|
# https://github.com/ReVanced/GmsCore
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "https://api.github.com/repos/TeamVanced/VancedMicroG/releases/latest"
|
Uri = "https://api.github.com/repos/ReVanced/GmsCore/releases/latest"
|
||||||
UseBasicParsing = $true
|
UseBasicParsing = $true
|
||||||
Verbose = $true
|
Verbose = $true
|
||||||
}
|
}
|
||||||
$URL = (Invoke-RestMethod @Parameters).assets.browser_download_url
|
$URL = (Invoke-RestMethod @Parameters).assets
|
||||||
$Parameters = @{
|
foreach($url in $URL) {
|
||||||
Uri = $URL
|
if ($url.name.Contains("-hw-")) {
|
||||||
Outfile = "$WorkingFolder\ReVanced\microg.apk"
|
$url.name = "microg-hw.apk"
|
||||||
UseBasicParsing = $true
|
} else {
|
||||||
Verbose = $true
|
$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.
|
# Sometimes older version of zulu-jdk causes conflict, so remove older version before proceeding.
|
||||||
if (Test-Path -Path "$WorkingFolder\ReVanced\jdk")
|
if (Test-Path -Path "$WorkingFolder\ReVanced\jdk")
|
||||||
@@ -182,12 +214,12 @@ Remove-Item -Path "$WorkingFolder\ReVanced\jdk_windows-x64_bin.zip" -Force
|
|||||||
-jar "$WorkingFolder\ReVanced\revanced-cli.jar" patch `
|
-jar "$WorkingFolder\ReVanced\revanced-cli.jar" patch `
|
||||||
--patch-bundle "$WorkingFolder\ReVanced\revanced-patches.jar" `
|
--patch-bundle "$WorkingFolder\ReVanced\revanced-patches.jar" `
|
||||||
--merge "$WorkingFolder\ReVanced\revanced-integrations.apk" `
|
--merge "$WorkingFolder\ReVanced\revanced-integrations.apk" `
|
||||||
--exclude "always-autorepeat" `
|
--exclude "Always repeat" `
|
||||||
--exclude "hide-captions-button" `
|
--exclude "Hide captions button" `
|
||||||
--exclude "hide-timestamp" `
|
--exclude "Hide timestamp" `
|
||||||
--exclude "hide-seekbar" `
|
--exclude "Hide seekbar" `
|
||||||
--purge `
|
--purge `
|
||||||
--resource-cache "$WorkingFolder\ReVanced\Temp" `
|
--temporary-files-path "$WorkingFolder\ReVanced\Temp" `
|
||||||
--out "$WorkingFolder\ReVanced\revanced.apk" `
|
--out "$WorkingFolder\ReVanced\revanced.apk" `
|
||||||
"$WorkingFolder\ReVanced\youtube.apk"
|
"$WorkingFolder\ReVanced\youtube.apk"
|
||||||
|
|
||||||
|
|||||||
11
README.md
11
README.md
@@ -9,12 +9,12 @@ Build ReVanced package (.apk) easily than ever using latest ReVanced patches and
|
|||||||
### Locally
|
### 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;
|
* 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
|
* always-autorepeat
|
||||||
* hide-captions-button
|
* hide-captions-button
|
||||||
* hide-timestamp
|
* hide-timestamp
|
||||||
* hide-seekbar
|
* 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 [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`;
|
* 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;
|
* 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.
|
* Release notes are generated dynamically using the [ReleaseNotesTemplate.md](https://github.com/JDM170/ReVanced_Builder/blob/main/ReleaseNotesTemplate.md) template.
|
||||||
@@ -30,17 +30,16 @@ Trigger the [`Build`](https://github.com/JDM170/ReVanced_Builder/actions/workflo
|
|||||||
## Requirements if you compile locally
|
## Requirements if you compile locally
|
||||||
|
|
||||||
* Windows 10 x64 or Windows 11
|
* Windows 10 x64 or Windows 11
|
||||||
* Windows PowerShell 5.1
|
* Windows PowerShell 5.1/7
|
||||||
* 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).
|
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
|
* [APKPure](https://apkpure.net)
|
||||||
* [APKMirror](https://apkmirror.com)
|
* [APKMirror](https://apkmirror.com)
|
||||||
* [ReVanced CLI](https://github.com/revanced/revanced-cli)
|
* [ReVanced CLI](https://github.com/revanced/revanced-cli)
|
||||||
* [ReVanced Patches](https://github.com/revanced/revanced-patches)
|
* [ReVanced Patches](https://github.com/revanced/revanced-patches)
|
||||||
* [ReVanced Integrations](https://github.com/revanced/revanced-integrations)
|
* [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)
|
* [AngleSharp](https://github.com/AngleSharp/AngleSharp)
|
||||||
* [Zulu JDK](https://github.com/ScoopInstaller/Java)
|
* [Zulu JDK](https://github.com/ScoopInstaller/Java)
|
||||||
* [Sophia Telegram chat](https://t.me/sophia_chat)
|
* [Sophia Telegram chat](https://t.me/sophia_chat)
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
* ReVanced CLI CLITag;
|
* ReVanced CLI CLITag;
|
||||||
* ReVanced Patches PatchesTag;
|
* ReVanced Patches PatchesTag;
|
||||||
* ReVanced Integrations IntegrationsTag;
|
* ReVanced Integrations IntegrationsTag;
|
||||||
* Vanced MicroG MicroGTag;
|
* ReVanced MicroG MicroGTag;
|
||||||
* Azul Zulu ZuluTag.
|
* Azul Zulu ZuluTag.
|
||||||
|
|||||||
@@ -1,18 +1,24 @@
|
|||||||
# https://github.com/TeamVanced/VancedMicroG
|
# https://github.com/ReVanced/GmsCore
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "https://api.github.com/repos/TeamVanced/VancedMicroG/releases/latest"
|
Uri = "https://api.github.com/repos/ReVanced/GmsCore/releases/latest"
|
||||||
UseBasicParsing = $true
|
UseBasicParsing = $true
|
||||||
Verbose = $true
|
Verbose = $true
|
||||||
}
|
}
|
||||||
$apiResult = Invoke-RestMethod @Parameters
|
$apiResult = Invoke-RestMethod @Parameters
|
||||||
$URL = $apiResult.assets.browser_download_url
|
|
||||||
$TAG = $apiResult.tag_name
|
$TAG = $apiResult.tag_name
|
||||||
$Parameters = @{
|
foreach($url in $apiResult.assets) {
|
||||||
Uri = $URL
|
if ($url.name.Contains("-hw-")) {
|
||||||
Outfile = "Temp\microg.apk"
|
$url.name = "microg-hw.apk"
|
||||||
UseBasicParsing = $true
|
} else {
|
||||||
Verbose = $true
|
$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
|
echo "MicroGTag=$TAG" >> $env:GITHUB_ENV
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ $Parameters = @{
|
|||||||
Verbose = $true
|
Verbose = $true
|
||||||
}
|
}
|
||||||
$apiResult = Invoke-RestMethod @Parameters
|
$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
|
$TAG = $apiResult.tag_name
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $URL
|
Uri = $URL
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ $Parameters = @{
|
|||||||
Verbose = $true
|
Verbose = $true
|
||||||
}
|
}
|
||||||
$apiResult = Invoke-RestMethod @Parameters
|
$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
|
$TAG = $apiResult.tag_name
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $URL
|
Uri = $URL
|
||||||
|
|||||||
@@ -1,14 +1,31 @@
|
|||||||
# Get latest supported YouTube client version via ReVanced JSON
|
# Get the latest supported YouTube version to patch
|
||||||
# It will let us to download always latest YouTube apk supported by ReVanced team
|
# https://api.revanced.app/docs/swagger
|
||||||
# https://github.com/revanced/revanced-patches/blob/main/patches.json
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "https://raw.githubusercontent.com/revanced/revanced-patches/main/patches.json"
|
Uri = "https://api.revanced.app/v2/patches/latest"
|
||||||
UseBasicParsing = $true
|
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
|
$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 = $versions | Sort-Object -Descending -Unique | Select-Object -First 1
|
||||||
$LatestSupportedYT = $LatestSupported.replace(".", "-")
|
|
||||||
|
# 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
|
$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
|
Add-Type -Path $AngleSharpAssemblyPath
|
||||||
@@ -16,26 +33,31 @@ Add-Type -Path $AngleSharpAssemblyPath
|
|||||||
# Create parser object
|
# Create parser object
|
||||||
$angleparser = New-Object -TypeName AngleSharp.Html.Parser.HtmlParser
|
$angleparser = New-Object -TypeName AngleSharp.Html.Parser.HtmlParser
|
||||||
|
|
||||||
# Try to find correct NON-Bundle version
|
# 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 = @{
|
$Parameters = @{
|
||||||
Uri = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupportedYT)-release/youtube-$($LatestSupportedYT)-android-apk-download/"
|
Uri = $apkMirrorLink
|
||||||
UseBasicParsing = $false # Disabled
|
UseBasicParsing = $false # Disabled
|
||||||
Verbose = $true
|
Verbose = $true
|
||||||
}
|
}
|
||||||
$URLParse = (Invoke-Webrequest @Parameters).Links.outerHTML | Where-Object -FilterScript {$_ -like "*YouTube $($LatestSupported) (nodpi)*"}
|
$Request = Invoke-Webrequest @Parameters
|
||||||
# Check if variable contains a data
|
$Parsed = $angleparser.ParseDocument($Request.Content)
|
||||||
if ($URLParse)
|
$Parsed.All | Where-Object -FilterScript {$_.ClassName -match "table-row headerFont"} | ForEach-Object -Process {
|
||||||
{
|
foreach($child in $_.children)
|
||||||
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupportedYT)-release/youtube-$($LatestSupportedYT)-android-apk-download/"
|
{
|
||||||
}
|
if ($child.InnerHtml -eq "nodpi")
|
||||||
else
|
{
|
||||||
{
|
$apkPackageLink = (($_.getElementsByTagName("a") | Select-Object -First 1).Href).Substring(57)
|
||||||
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupportedYT)-release/youtube-$($LatestSupportedYT)-2-android-apk-download/"
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$apkMirrorLink += $apkPackageLink # actual APK link (not BUNDLE)
|
||||||
|
|
||||||
# Get unique key to generate direct link
|
# Get unique key to generate direct link
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $URL
|
Uri = $apkMirrorLink
|
||||||
UseBasicParsing = $false # Disabled
|
UseBasicParsing = $false # Disabled
|
||||||
Verbose = $true
|
Verbose = $true
|
||||||
}
|
}
|
||||||
@@ -44,7 +66,7 @@ $Parsed = $angleparser.ParseDocument($Request.Content)
|
|||||||
$Key = $Parsed.All | Where-Object -FilterScript {$_.ClassName -match "accent_bg btn btn-flat downloadButton"} | ForEach-Object -Process {$_.Search}
|
$Key = $Parsed.All | Where-Object -FilterScript {$_.ClassName -match "accent_bg btn btn-flat downloadButton"} | ForEach-Object -Process {$_.Search}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$($URL)/download/$($Key)"
|
Uri = $apkMirrorLink + "download/$($Key)"
|
||||||
UseBasicParsing = $true
|
UseBasicParsing = $true
|
||||||
Verbose = $true
|
Verbose = $true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user