Skip to content

Commit

Permalink
move NewPipe init to NewPipeUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
gechoto authored Jan 9, 2025
1 parent 3239896 commit 01f4df1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 6 additions & 1 deletion innertube/src/main/java/com/zionhuang/innertube/NewPipe.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import io.ktor.http.URLBuilder
import io.ktor.http.parseQueryString
import okhttp3.OkHttpClient
import okhttp3.RequestBody.Companion.toRequestBody
import org.schabi.newpipe.extractor.NewPipe
import org.schabi.newpipe.extractor.downloader.Downloader
import org.schabi.newpipe.extractor.downloader.Request
import org.schabi.newpipe.extractor.downloader.Response
Expand All @@ -14,7 +15,7 @@ import org.schabi.newpipe.extractor.exceptions.ReCaptchaException
import org.schabi.newpipe.extractor.services.youtube.YoutubeJavaScriptPlayerManager
import java.io.IOException

object NewPipeDownloaderImpl : Downloader() {
private object NewPipeDownloaderImpl : Downloader() {

private val client = OkHttpClient.Builder().build()

Expand Down Expand Up @@ -59,6 +60,10 @@ object NewPipeDownloaderImpl : Downloader() {

object NewPipeUtils {

init {
NewPipe.init(NewPipeDownloaderImpl)
}

fun getSignatureTimestamp(videoId: String): Result<Int> = runCatching {
YoutubeJavaScriptPlayerManager.getSignatureTimestamp(videoId)
}
Expand Down
5 changes: 0 additions & 5 deletions innertube/src/main/java/com/zionhuang/innertube/YouTube.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonPrimitive
import org.schabi.newpipe.extractor.NewPipe
import java.net.Proxy

/**
Expand All @@ -61,10 +60,6 @@ import java.net.Proxy
object YouTube {
private val innerTube = InnerTube()

init {
NewPipe.init(NewPipeDownloaderImpl)
}

var locale: YouTubeLocale
get() = innerTube.locale
set(value) {
Expand Down

0 comments on commit 01f4df1

Please sign in to comment.