Update from YouTube to Spotify
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
32
.github/workflows/Build.yml
vendored
32
.github/workflows/Build.yml
vendored
@@ -14,11 +14,11 @@ jobs:
|
||||
run: |
|
||||
Install-Package AngleSharp -Source https://www.nuget.org/api/v2 -SkipDependencies -Force
|
||||
|
||||
- name: Download YouTube
|
||||
- name: Download Spotify
|
||||
run: |
|
||||
New-Item -Path Temp -ItemType Directory -Force
|
||||
|
||||
. Scripts\YouTube.ps1
|
||||
. Scripts\Spotify.ps1
|
||||
|
||||
- name: Download ReVanced CLI
|
||||
run: |
|
||||
@@ -28,10 +28,6 @@ jobs:
|
||||
run: |
|
||||
. Scripts\ReVanced_Patches.ps1
|
||||
|
||||
- name: Download Vanced MicroG
|
||||
run: |
|
||||
. Scripts\MicroG.ps1
|
||||
|
||||
- name: Download and expanding Zulu JDK
|
||||
run: |
|
||||
. Scripts\Zulu_JDK.ps1
|
||||
@@ -43,30 +39,16 @@ jobs:
|
||||
& $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" `
|
||||
--disable "Custom theme" `
|
||||
--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
|
||||
--out "Temp\revanced_spotify.apk" `
|
||||
"Temp\spotify.apk"
|
||||
|
||||
- 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
|
||||
(Get-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Raw).replace("SpotifyTag", "${{ env.LatestSupportedYT }}").replace("CLITag", "${{ env.CLIvtag }}").replace("PatchesTag", "${{ env.Patchesvtag }}").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"
|
||||
@@ -77,4 +59,4 @@ jobs:
|
||||
with:
|
||||
tag_name: ${{ env.RELEASE_NAME }}
|
||||
body_path: ${{ steps.read_release.outputs.ReleaseBody }}
|
||||
files: ReVanced.zip
|
||||
files: revanced_spotify.apk
|
||||
|
||||
74
Build.ps1
74
Build.ps1
@@ -34,40 +34,13 @@ 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
|
||||
$LatestSupported = "9-0-44-478"
|
||||
|
||||
Write-Verbose -Message "" -Verbose
|
||||
Write-Verbose -Message "Downloading the latest supported YouTube apk" -Verbose
|
||||
|
||||
Write-Verbose -Message "Downloading the latest supported Spotify 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/"
|
||||
# https://www.apkmirror.com/apk/spotify-ab/spotify-music-podcasts/
|
||||
$apkMirrorLink = "https://www.apkmirror.com/apk/spotify-ab/spotify-music-podcasts/spotify-music-and-podcasts-$LatestSupported-release/"
|
||||
$Parameters = @{
|
||||
Uri = $apkMirrorLink
|
||||
UseBasicParsing = $false # Disabled
|
||||
@@ -107,7 +80,7 @@ $URL_Part = $URL_Part.Replace("&", "&")
|
||||
# Finally, get the real link
|
||||
$Parameters = @{
|
||||
Uri = "https://www.apkmirror.com$URL_Part"
|
||||
OutFile = "$CurrentFolder\ReVanced\youtube.apk"
|
||||
OutFile = "$CurrentFolder\ReVanced\spotify.apk"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
@@ -147,30 +120,6 @@ $Parameters = @{
|
||||
}
|
||||
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")
|
||||
{
|
||||
@@ -209,14 +158,11 @@ Remove-Item -Path "$CurrentFolder\ReVanced\jdk_windows-x64_bin.zip" -Force
|
||||
& "$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" `
|
||||
--disable "Custom theme" `
|
||||
--purge `
|
||||
--temporary-files-path "$CurrentFolder\ReVanced\Temp" `
|
||||
--out "$CurrentFolder\ReVanced\revanced.apk" `
|
||||
"$CurrentFolder\ReVanced\youtube.apk"
|
||||
--out "$CurrentFolder\ReVanced\revanced_spotify.apk" `
|
||||
"$CurrentFolder\ReVanced\spotify.apk"
|
||||
|
||||
# Open working directory with builded files
|
||||
# Invoke-Item -Path "$CurrentFolder\ReVanced"
|
||||
@@ -229,8 +175,8 @@ $Files = @(
|
||||
"$CurrentFolder\ReVanced\jdk",
|
||||
"$CurrentFolder\ReVanced\revanced-cli.jar",
|
||||
"$CurrentFolder\ReVanced\revanced-patches.rvp",
|
||||
"$CurrentFolder\ReVanced\youtube.apk"
|
||||
"$CurrentFolder\ReVanced\spotify.apk"
|
||||
)
|
||||
Remove-Item -Path $Files -Recurse -Force
|
||||
|
||||
Write-Warning -Message "Latest available revanced.apk & microg.apk are ready in `"$CurrentFolder\ReVanced`""
|
||||
Write-Warning -Message "Latest available revanced_spotify.apk & microg.apk are ready in `"$CurrentFolder\ReVanced`""
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
## Automatically generated release notes
|
||||
|
||||
* YouTube YouTubeTag;
|
||||
* Spotify SpotifyTag;
|
||||
* ReVanced CLI CLITag;
|
||||
* ReVanced Patches PatchesTag;
|
||||
* ReVanced MicroG MicroGTag;
|
||||
* Azul Zulu ZuluTag.
|
||||
|
||||
@@ -1,31 +1,5 @@
|
||||
# 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
|
||||
#>
|
||||
$LatestSupported = "9-0-44-478"
|
||||
|
||||
$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
|
||||
@@ -33,9 +7,10 @@ Add-Type -Path $AngleSharpAssemblyPath
|
||||
# Create parser object
|
||||
$angleparser = New-Object -TypeName AngleSharp.Html.Parser.HtmlParser
|
||||
|
||||
# We need a 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/"
|
||||
# https://www.apkmirror.com/apk/spotify-ab/spotify-music-podcasts/
|
||||
$apkMirrorLink = "https://www.apkmirror.com/apk/spotify-ab/spotify-music-podcasts/spotify-music-and-podcasts-$LatestSupported-release/"
|
||||
$Parameters = @{
|
||||
Uri = $apkMirrorLink
|
||||
UseBasicParsing = $false # Disabled
|
||||
@@ -77,7 +52,7 @@ $Key = ($Parsed.All | Where-Object -FilterScript { $_.InnerHtml -eq "here" }).Se
|
||||
# Finally, get the real link
|
||||
$Parameters = @{
|
||||
Uri = "https://www.apkmirror.com/wp-content/themes/APKMirror/download.php$Key"
|
||||
OutFile = "Temp\youtube.apk"
|
||||
OutFile = "Temp\spotify.apk"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
Reference in New Issue
Block a user