mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2026-11-23 23:57:23 +00:00
Add brotli support to downloader
This commit is contained in:
1 parent
978ba91294
commit
906bd08681
3 files changed
+8
-1
No files matched your search
@@ -144,7 +144,6 @@ ksp {
|
||||
arg("room.schemaLocation", "$projectDir/schemas")
|
||||
}
|
||||
|
||||
|
||||
// Custom dependency configuration for ktlint
|
||||
val ktlint by configurations.creating
|
||||
|
||||
@@ -268,6 +267,7 @@ dependencies {
|
||||
|
||||
// HTTP client
|
||||
implementation(libs.squareup.okhttp)
|
||||
implementation(libs.squareup.okhttp.brotli)
|
||||
|
||||
// Media player
|
||||
implementation(libs.google.exoplayer.core)
|
||||
|
||||
@@ -23,9 +23,12 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import okhttp3.CompressionInterceptor;
|
||||
import okhttp3.Gzip;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import okhttp3.brotli.Brotli;
|
||||
|
||||
public final class DownloaderImpl extends Downloader {
|
||||
public static final String USER_AGENT =
|
||||
@@ -44,6 +47,9 @@ public final class DownloaderImpl extends Downloader {
|
||||
.readTimeout(30, TimeUnit.SECONDS)
|
||||
// .cache(new Cache(new File(context.getExternalCacheDir(), "okhttp"),
|
||||
// 16 * 1024 * 1024))
|
||||
.addInterceptor(new CompressionInterceptor(
|
||||
Brotli.INSTANCE,
|
||||
Gzip.INSTANCE))
|
||||
.build();
|
||||
this.mCookies = new HashMap<>();
|
||||
}
|
||||
|
||||
@@ -168,6 +168,7 @@ squareup-leakcanary-core = { module = "com.squareup.leakcanary:leakcanary-androi
|
||||
squareup-leakcanary-plumber = { module = "com.squareup.leakcanary:plumber-android", version.ref = "leakcanary" }
|
||||
squareup-leakcanary-watcher = { module = "com.squareup.leakcanary:leakcanary-object-watcher-android", version.ref = "leakcanary" }
|
||||
squareup-okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
|
||||
squareup-okhttp-brotli = { module = "com.squareup.okhttp3:okhttp-brotli", version.ref = "okhttp" }
|
||||
touchlab-kermit = { module = "co.touchlab:kermit", version.ref = "kermit" }
|
||||
zacsweers-autoservice-compiler = { module = "dev.zacsweers.autoservice:auto-service-ksp", version.ref = "autoservice-zacsweers" }
|
||||
|
||||
|
||||
Reference in new issue
Block a user