From 9f1dbbc7d06be2f20ff8c4a846664f88139d6404 Mon Sep 17 00:00:00 2001 From: Priveetee Date: Mon, 31 Aug 2026 14:19:48 +0200 Subject: [PATCH 01/12] ci: route workflows to R730 runners --- .github/workflows/ci.yml | 2 +- .github/workflows/coverage.yml | 2 +- .github/workflows/docker.yml | 8 ++++---- .github/workflows/openapi.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 413eb721..5a22891d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ concurrency: jobs: build: - runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04' || fromJSON('["self-hosted","Linux","X64","arko"]') }} + runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04' || fromJSON('["self-hosted","Linux","X64","r730"]') }} steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7b38c40d..18d1dfd2 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -13,7 +13,7 @@ concurrency: jobs: coverage: - runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04' || fromJSON('["self-hosted","Linux","X64","arko"]') }} + runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04' || fromJSON('["self-hosted","Linux","X64","r730"]') }} steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 07c4ac15..a53dc8d6 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -21,7 +21,7 @@ concurrency: jobs: prepare-image: - runs-on: [self-hosted, Linux, X64, arko] + runs-on: [self-hosted, Linux, X64, r730] permissions: contents: read outputs: @@ -76,7 +76,7 @@ jobs: build-platform: needs: prepare-image - runs-on: [self-hosted, Linux, X64, arko, docker] + runs-on: [self-hosted, Linux, X64, r730, docker] timeout-minutes: 20 permissions: contents: read @@ -150,7 +150,7 @@ jobs: build-and-push: needs: [prepare-image, build-platform] - runs-on: [self-hosted, Linux, X64, arko, docker] + runs-on: [self-hosted, Linux, X64, r730, docker] timeout-minutes: 10 permissions: contents: read @@ -235,7 +235,7 @@ jobs: notify-orchestrator: needs: [prepare-image, build-and-push] if: github.ref_name == 'dev' || github.ref_name == 'main' || startsWith(github.ref, 'refs/tags/v') - runs-on: [self-hosted, Linux, X64, arko] + runs-on: [self-hosted, Linux, X64, r730] permissions: contents: read env: diff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.yml index 4abbc6c3..4b50635e 100644 --- a/.github/workflows/openapi.yml +++ b/.github/workflows/openapi.yml @@ -15,7 +15,7 @@ concurrency: jobs: validate: - runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04' || fromJSON('["self-hosted","Linux","X64","arko"]') }} + runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-24.04' || fromJSON('["self-hosted","Linux","X64","r730"]') }} steps: - uses: actions/checkout@v7 - name: Isolate Gradle user home From f74bf02277e12992dbae1c1b2b1cb77b2d864340 Mon Sep 17 00:00:00 2001 From: Tax_Tux <138765817+Priveetee@users.noreply.github.com> Date: Mon, 31 Aug 2026 21:30:53 +0200 Subject: [PATCH 02/12] chore: benchmark dev runners From f604dad788767e35b0b430e5e30981b5160323c7 Mon Sep 17 00:00:00 2001 From: Priveetee Date: Fri, 4 Sep 2026 08:24:42 +0200 Subject: [PATCH 03/12] feat: add batch playback progress lookup --- openapi.yaml | 3 ++ openapi/components/progress.yaml | 30 ++++++++++++ openapi/paths/progress.yaml | 33 +++++++++++++ .../kotlin/dev/typetype/server/AppMetrics.kt | 1 + .../typetype/server/routes/ProgressRoutes.kt | 19 +++++++ .../server/services/ProgressService.kt | 18 +++++++ .../dev/typetype/server/ProgressRoutesTest.kt | 49 +++++++++++++++++++ 7 files changed, 153 insertions(+) create mode 100644 openapi/components/progress.yaml create mode 100644 openapi/paths/progress.yaml diff --git a/openapi.yaml b/openapi.yaml index 63aec2da..508706c3 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -56,6 +56,7 @@ paths: /rss/feeds/{id}/regenerate: { $ref: ./openapi/paths/rss.yaml#/RssFeedRegenerate } /rss/feeds/{id}.xml: { $ref: ./openapi/paths/rss.yaml#/RssFeedDocument } /settings: { $ref: ./openapi/paths/access-control.yaml#/Settings } + /progress/batch: { $ref: ./openapi/paths/progress.yaml#/ProgressBatch } /backup/typetype: { $ref: ./openapi/paths/user-backup.yaml#/TypeTypeBackup } /restore/typetype: { $ref: ./openapi/paths/user-backup.yaml#/TypeTypeRestore } /portability/formats: { $ref: ./openapi/paths/portability.yaml#/PortabilityFormats } @@ -173,6 +174,8 @@ components: RssFeedSecretItem: { $ref: ./openapi/components/rss.yaml#/RssFeedSecretItem } AdminRssFeedsPage: { $ref: ./openapi/components/rss.yaml#/AdminRssFeedsPage } SettingsItem: { $ref: ./openapi/components/access-control.yaml#/SettingsItem } + ProgressItem: { $ref: ./openapi/components/progress.yaml#/ProgressItem } + ProgressBatchRequest: { $ref: ./openapi/components/progress.yaml#/ProgressBatchRequest } TypeTypeBackupItem: { $ref: ./openapi/components/user-backup.yaml#/TypeTypeBackupItem } TypeTypeRestoreSummary: { $ref: ./openapi/components/user-backup.yaml#/TypeTypeRestoreSummary } PortabilityAdapterDescriptor: { $ref: ./openapi/components/portability.yaml#/PortabilityAdapterDescriptor } diff --git a/openapi/components/progress.yaml b/openapi/components/progress.yaml new file mode 100644 index 00000000..da01f073 --- /dev/null +++ b/openapi/components/progress.yaml @@ -0,0 +1,30 @@ +ProgressItem: + type: object + required: [videoUrl, position, updatedAt] + properties: + videoUrl: + type: string + format: uri + position: + type: integer + format: int64 + minimum: 0 + description: Playback position in milliseconds. + updatedAt: + type: integer + format: int64 + minimum: 0 + description: Unix timestamp in milliseconds. + +ProgressBatchRequest: + type: object + required: [videoUrls] + properties: + videoUrls: + type: array + minItems: 1 + maxItems: 200 + items: + type: string + format: uri + maxLength: 2048 diff --git a/openapi/paths/progress.yaml b/openapi/paths/progress.yaml new file mode 100644 index 00000000..67c422d4 --- /dev/null +++ b/openapi/paths/progress.yaml @@ -0,0 +1,33 @@ +ProgressBatch: + post: + tags: [user-data] + summary: Read playback progress for multiple videos + security: + - bearerAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: ../components/progress.yaml#/ProgressBatchRequest + responses: + '200': + description: Progress entries in request order. Videos without saved progress have position and updatedAt set to zero. + content: + application/json: + schema: + type: array + items: + $ref: ../components/progress.yaml#/ProgressItem + '400': + description: Invalid request body or video URL list. + content: + application/json: + schema: + $ref: ../components/common.yaml#/ErrorResponse + '401': + description: Authentication required. + content: + application/json: + schema: + $ref: ../components/common.yaml#/ErrorResponse diff --git a/src/main/kotlin/dev/typetype/server/AppMetrics.kt b/src/main/kotlin/dev/typetype/server/AppMetrics.kt index 617bfade..b74be9d8 100644 --- a/src/main/kotlin/dev/typetype/server/AppMetrics.kt +++ b/src/main/kotlin/dev/typetype/server/AppMetrics.kt @@ -43,6 +43,7 @@ fun metricPath(path: String): String = when { path.startsWith("/downloader/jobs/") && path.endsWith("/artifact") -> "/downloader/jobs/{id}/artifact" path.startsWith("/downloader/jobs/") && path.endsWith("/cancel") -> "/downloader/jobs/{id}/cancel" path.startsWith("/downloader/jobs/") -> "/downloader/jobs/{id}" + path == "/progress/batch" -> path path.startsWith("/progress/") -> "/progress/{videoUrl}" path.startsWith("/favorites/") -> "/favorites/{videoUrl}" path.startsWith("/watch-later/") -> "/watch-later/{videoUrl}" diff --git a/src/main/kotlin/dev/typetype/server/routes/ProgressRoutes.kt b/src/main/kotlin/dev/typetype/server/routes/ProgressRoutes.kt index 981470a9..c30713f5 100644 --- a/src/main/kotlin/dev/typetype/server/routes/ProgressRoutes.kt +++ b/src/main/kotlin/dev/typetype/server/routes/ProgressRoutes.kt @@ -10,13 +10,29 @@ import io.ktor.server.request.receive import io.ktor.server.response.respond import io.ktor.server.routing.Route import io.ktor.server.routing.get +import io.ktor.server.routing.post import io.ktor.server.routing.put import kotlinx.serialization.Serializable @Serializable internal data class ProgressBody(val position: Long) +@Serializable +internal data class ProgressBatchBody(val videoUrls: List) + fun Route.progressRoutes(progressService: ProgressService, authService: AuthService, settingsService: SettingsService? = null) { + post("/progress/batch") { + call.withJwtAuth(authService) { userId -> + val body = runCatching { call.receive() }.getOrElse { + return@withJwtAuth call.respond(HttpStatusCode.BadRequest, ErrorResponse("Invalid request body")) + } + if (body.videoUrls.isEmpty() || body.videoUrls.size > MAX_PROGRESS_BATCH_SIZE || body.videoUrls.any { it.isBlank() || it.length > MAX_VIDEO_URL_LENGTH }) { + return@withJwtAuth call.respond(HttpStatusCode.BadRequest, ErrorResponse("Invalid videoUrls")) + } + val videoUrls = body.videoUrls.distinct() + call.respond(progressService.getMany(userId, videoUrls)) + } + } get("/progress/{videoUrl...}") { call.withJwtAuth(authService) { userId -> val videoUrl = call.urlTailParameter("videoUrl") ?: return@withJwtAuth call.respond(HttpStatusCode.BadRequest, ErrorResponse("Missing videoUrl")) @@ -59,6 +75,9 @@ fun Route.progressRoutes(progressService: ProgressService, authService: AuthServ } } +private const val MAX_PROGRESS_BATCH_SIZE = 200 +private const val MAX_VIDEO_URL_LENGTH = 2_048 + private fun skippedProgress(videoUrl: String, position: Long): ProgressItem = ProgressItem( videoUrl = videoUrl, position = position.coerceAtLeast(0L), diff --git a/src/main/kotlin/dev/typetype/server/services/ProgressService.kt b/src/main/kotlin/dev/typetype/server/services/ProgressService.kt index e73dea44..ae39d248 100644 --- a/src/main/kotlin/dev/typetype/server/services/ProgressService.kt +++ b/src/main/kotlin/dev/typetype/server/services/ProgressService.kt @@ -5,6 +5,7 @@ import dev.typetype.server.db.tables.ProgressTable import dev.typetype.server.models.ProgressItem import org.jetbrains.exposed.v1.core.and import org.jetbrains.exposed.v1.core.eq +import org.jetbrains.exposed.v1.core.inList import org.jetbrains.exposed.v1.jdbc.insert import org.jetbrains.exposed.v1.jdbc.selectAll import org.jetbrains.exposed.v1.jdbc.update @@ -38,6 +39,23 @@ class ProgressService { } } + suspend fun getMany(userId: String, videoUrls: List): List = DatabaseFactory.query { + val orderedUrls = videoUrls.distinct() + if (orderedUrls.isEmpty()) return@query emptyList() + val progressByUrl = ProgressTable.selectAll() + .where { (ProgressTable.userId eq userId) and (ProgressTable.videoUrl inList orderedUrls) } + .associate { row -> + row[ProgressTable.videoUrl] to ProgressItem( + videoUrl = row[ProgressTable.videoUrl], + position = row[ProgressTable.position], + updatedAt = row[ProgressTable.updatedAt], + ) + } + orderedUrls.map { videoUrl -> + progressByUrl[videoUrl] ?: ProgressItem(videoUrl = videoUrl, position = 0L) + } + } + suspend fun upsert(userId: String, videoUrl: String, position: Long): ProgressItem { val now = System.currentTimeMillis() val safePosition = position.coerceAtLeast(0L) diff --git a/src/test/kotlin/dev/typetype/server/ProgressRoutesTest.kt b/src/test/kotlin/dev/typetype/server/ProgressRoutesTest.kt index 13f7cbbb..2a64a834 100644 --- a/src/test/kotlin/dev/typetype/server/ProgressRoutesTest.kt +++ b/src/test/kotlin/dev/typetype/server/ProgressRoutesTest.kt @@ -3,8 +3,10 @@ package dev.typetype.server import dev.typetype.server.routes.progressRoutes import dev.typetype.server.services.AuthService import dev.typetype.server.services.ProgressService +import dev.typetype.server.models.ProgressItem import io.ktor.client.request.get import io.ktor.client.request.headers +import io.ktor.client.request.post import io.ktor.client.request.put import io.ktor.client.request.setBody import io.ktor.client.statement.bodyAsText @@ -17,6 +19,7 @@ import io.ktor.server.plugins.contentnegotiation.ContentNegotiation import io.ktor.server.routing.routing import io.ktor.server.testing.ApplicationTestBuilder import io.ktor.server.testing.testApplication +import kotlinx.serialization.json.Json import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.BeforeAll @@ -117,4 +120,50 @@ class ProgressRoutesTest { assertEquals(HttpStatusCode.OK, getResponse.status) assertTrue(getResponse.bodyAsText().contains("\"position\":3300")) } + + @Test + fun `POST progress batch returns exact positions in request order`() = withApp { + service.upsert(TEST_USER_ID, "https://yt.com/watch?v=first", 12_345L) + service.upsert(TEST_USER_ID, "https://yt.com/watch?v=second", 67_890L) + service.upsert("another-user", "https://yt.com/watch?v=private", 99_999L) + + val response = client.post("/progress/batch") { + headers.append(HttpHeaders.Authorization, "Bearer test-jwt") + headers.append(HttpHeaders.ContentType, ContentType.Application.Json.toString()) + setBody("""{"videoUrls":["https://yt.com/watch?v=second","https://yt.com/watch?v=missing","https://yt.com/watch?v=first","https://yt.com/watch?v=second","https://yt.com/watch?v=private"]}""") + } + + assertEquals(HttpStatusCode.OK, response.status) + val items = Json.decodeFromString>(response.bodyAsText()) + assertEquals( + listOf( + "https://yt.com/watch?v=second", + "https://yt.com/watch?v=missing", + "https://yt.com/watch?v=first", + "https://yt.com/watch?v=private", + ), + items.map(ProgressItem::videoUrl), + ) + assertEquals(listOf(67_890L, 0L, 12_345L, 0L), items.map(ProgressItem::position)) + } + + @Test + fun `POST progress batch validates authentication and request limits`() = withApp { + val body = """{"videoUrls":["https://yt.com/watch?v=test"]}""" + assertEquals(HttpStatusCode.Unauthorized, client.post("/progress/batch") { + headers.append(HttpHeaders.ContentType, ContentType.Application.Json.toString()) + setBody(body) + }.status) + assertEquals(HttpStatusCode.BadRequest, client.post("/progress/batch") { + headers.append(HttpHeaders.Authorization, "Bearer test-jwt") + headers.append(HttpHeaders.ContentType, ContentType.Application.Json.toString()) + setBody("""{"videoUrls":[]}""") + }.status) + val tooMany = (0..200).joinToString(",") { "\"https://yt.com/watch?v=$it\"" } + assertEquals(HttpStatusCode.BadRequest, client.post("/progress/batch") { + headers.append(HttpHeaders.Authorization, "Bearer test-jwt") + headers.append(HttpHeaders.ContentType, ContentType.Application.Json.toString()) + setBody("""{"videoUrls":[$tooMany]}""") + }.status) + } } From bdd5f045c6a54a7af02b3a0e9dd21e1c2fc42679 Mon Sep 17 00:00:00 2001 From: Priveetee Date: Fri, 4 Sep 2026 11:43:46 +0200 Subject: [PATCH 04/12] refactor: add TypeType SABR boundary models --- .../typetype/server/sabr/SabrExceptions.kt | 4 ++ .../dev/typetype/server/sabr/SabrFormat.kt | 30 +++++++++++++ .../dev/typetype/server/sabr/SabrInfo.kt | 30 +++++++++++++ .../dev/typetype/server/sabr/SabrMedia.kt | 45 +++++++++++++++++++ .../dev/typetype/server/sabr/SabrPolicy.kt | 11 +++++ .../dev/typetype/server/sabr/SabrProfile.kt | 18 ++++++++ .../dev/typetype/server/sabr/SabrRange.kt | 40 +++++++++++++++++ .../dev/typetype/server/sabr/SabrRequest.kt | 29 ++++++++++++ .../typetype/server/sabr/SabrTokenProvider.kt | 5 +++ 9 files changed, 212 insertions(+) create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrExceptions.kt create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrFormat.kt create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrInfo.kt create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrMedia.kt create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrPolicy.kt create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrProfile.kt create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrRange.kt create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrRequest.kt create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrTokenProvider.kt diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrExceptions.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrExceptions.kt new file mode 100644 index 00000000..fd73c3dc --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrExceptions.kt @@ -0,0 +1,4 @@ +package dev.typetype.server.sabr + +internal typealias SabrProtocolException = org.schabi.newpipe.extractor.services.youtube.sabr.SabrProtocolException +internal typealias SabrRecoverableException = org.schabi.newpipe.extractor.services.youtube.sabr.SabrRecoverableException diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrFormat.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrFormat.kt new file mode 100644 index 00000000..79d46ef0 --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrFormat.kt @@ -0,0 +1,30 @@ +package dev.typetype.server.sabr + +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat as PipeFormat + +/** TypeType's stable representation of a provider media format. */ +internal class YoutubeSabrFormat internal constructor( + internal val delegate: PipeFormat, +) { + val isAudio: Boolean get() = delegate.isAudio + val isVideo: Boolean get() = delegate.isVideo + val itag: Int get() = delegate.itag + val lastModified: Long get() = delegate.lastModified + val xtags: String? get() = delegate.xtags + val mimeType: String? get() = delegate.mimeType + val audioTrackId: String? get() = delegate.audioTrackId + val audioTrackDisplayName: String? get() = delegate.audioTrackDisplayName + val isAudioDefault: Boolean get() = delegate.isAudioDefault + val isOriginalAudio: Boolean get() = delegate.isOriginalAudio + val qualityLabel: String? get() = delegate.qualityLabel + val audioQuality: String? get() = delegate.audioQuality + val isDrc: Boolean get() = delegate.isDrc + val width: Int get() = delegate.width + val height: Int get() = delegate.height + val bitrate: Int get() = delegate.bitrate + val contentLength: Long get() = delegate.contentLength + val approxDurationMs: Long get() = delegate.approxDurationMs + val initializationUrl: String? get() = delegate.initializationUrl + val initRangeStart: Long get() = delegate.initRangeStart + val initRangeEnd: Long get() = delegate.initRangeEnd +} diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrInfo.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrInfo.kt new file mode 100644 index 00000000..68c9785f --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrInfo.kt @@ -0,0 +1,30 @@ +package dev.typetype.server.sabr + +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo as PipeInfo +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat as PipeFormat +import java.util.IdentityHashMap + +/** Provider-independent SABR metadata used by TypeType's orchestration layer. */ +internal class YoutubeSabrInfo internal constructor( + internal val delegate: PipeInfo, + private val formatCache: IdentityHashMap = IdentityHashMap(), +) { + val profile: YoutubeSabrClientProfile + get() = YoutubeSabrClientProfile.fromDelegate(delegate.profile) + val videoId: String get() = delegate.videoId + val cpn: String get() = delegate.cpn + val clientVersion: String get() = delegate.clientVersion + val visitorData: String? get() = delegate.visitorData + val serverAbrStreamingUrl: String? get() = delegate.serverAbrStreamingUrl + val videoPlaybackUstreamerConfig: String? get() = delegate.videoPlaybackUstreamerConfig + val isPlayerPoTokenAttached: Boolean get() = delegate.isPlayerPoTokenAttached + val formats: List + get() = delegate.formats.map(::format) + + fun findBestAudioFormat(): YoutubeSabrFormat? = delegate.findBestAudioFormat()?.let(::format) + fun findLowestVideoFormat(): YoutubeSabrFormat? = delegate.findLowestVideoFormat()?.let(::format) + fun findFormatByItag(itag: Int): YoutubeSabrFormat? = delegate.findFormatByItag(itag)?.let(::format) + + private fun format(delegateFormat: PipeFormat): YoutubeSabrFormat = + formatCache.getOrPut(delegateFormat) { YoutubeSabrFormat(delegateFormat) } +} diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrMedia.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrMedia.kt new file mode 100644 index 00000000..23b74cee --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrMedia.kt @@ -0,0 +1,45 @@ +package dev.typetype.server.sabr + +import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader as PipeHeader +import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment as PipeSegment +import java.io.InputStream + +internal class SabrMediaHeader internal constructor( + private val delegate: PipeHeader, +) { + val headerId: Int get() = delegate.headerId + val videoId: String? get() = delegate.videoId + val itag: Int get() = delegate.itag + val lastModified: Long get() = delegate.lastModified + val xtags: String? get() = delegate.xtags + val startRange: Long get() = delegate.startRange + val compressionAlgorithm: Int get() = delegate.compressionAlgorithm + val isInitSegment: Boolean get() = delegate.isInitSegment + val sequenceNumber: Int get() = delegate.sequenceNumber + val bitrateBps: Long get() = delegate.bitrateBps + val startMs: Long get() = delegate.startMs + val durationMs: Long get() = delegate.durationMs + val contentLength: Long get() = delegate.contentLength + val timeRangeStartTicks: Long get() = delegate.timeRangeStartTicks + val timeRangeDurationTicks: Long get() = delegate.timeRangeDurationTicks + val timeRangeTimescale: Int get() = delegate.timeRangeTimescale + val sequenceLastModified: Long get() = delegate.sequenceLastModified + fun summarize(): String = delegate.summarize() +} + +internal class SabrMediaSegment private constructor( + internal val delegate: PipeSegment, +) { + val header: SabrMediaHeader = SabrMediaHeader(delegate.header) + val data: ByteArray get() = delegate.data + fun openStream(): InputStream = delegate.openStream() + val isDiskBacked: Boolean get() = delegate.isDiskBacked + val isComplete: Boolean get() = delegate.isComplete + val hasFailed: Boolean get() = delegate.hasFailed() + fun delete(): Unit = delegate.delete() + val length: Int get() = delegate.length + + companion object { + internal fun fromDelegate(segment: PipeSegment): SabrMediaSegment = SabrMediaSegment(segment) + } +} diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrPolicy.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrPolicy.kt new file mode 100644 index 00000000..1effadf6 --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrPolicy.kt @@ -0,0 +1,11 @@ +package dev.typetype.server.sabr + +import org.schabi.newpipe.extractor.services.youtube.sabr.SabrNextRequestPolicy as PipePolicy + +internal class SabrNextRequestPolicy internal constructor( + private val delegate: PipePolicy, +) { + val targetAudioReadaheadMs: Int get() = delegate.targetAudioReadaheadMs + val targetVideoReadaheadMs: Int get() = delegate.targetVideoReadaheadMs + val maxTimeSinceLastRequestMs: Int get() = delegate.maxTimeSinceLastRequestMs +} diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrProfile.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrProfile.kt new file mode 100644 index 00000000..0c07023a --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrProfile.kt @@ -0,0 +1,18 @@ +package dev.typetype.server.sabr + +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile as PipeProfile + +internal enum class YoutubeSabrClientProfile(internal val delegate: PipeProfile) { + WEB(PipeProfile.WEB), + MWEB(PipeProfile.MWEB), + WEB_EMBEDDED(PipeProfile.WEB_EMBEDDED), + ANDROID(PipeProfile.ANDROID), + ANDROID_VR(PipeProfile.ANDROID_VR), + IOS(PipeProfile.IOS), + TVHTML5(PipeProfile.TVHTML5); + + companion object { + internal fun fromDelegate(profile: PipeProfile): YoutubeSabrClientProfile = + entries.first { it.delegate == profile } + } +} diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrRange.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrRange.kt new file mode 100644 index 00000000..6a8d95ac --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrRange.kt @@ -0,0 +1,40 @@ +package dev.typetype.server.sabr + +import org.schabi.newpipe.extractor.services.youtube.sabr.SabrBufferedRange as PipeRange + +internal class SabrBufferedRange internal constructor( + val itag: Int, + val lastModified: Long, + val xtags: String?, + val startTimeMs: Long, + val durationMs: Long, + val startSegmentIndex: Int, + val endSegmentIndex: Int, + val timescale: Int, +) { + internal var delegate = PipeRange( + itag, + lastModified, + xtags, + startTimeMs, + durationMs, + startSegmentIndex, + endSegmentIndex, + timescale, + ) + + fun summarize(): String = delegate.summarize() + + internal companion object { + fun fromDelegate(delegate: PipeRange): SabrBufferedRange = SabrBufferedRange( + delegate.itag, + delegate.lastModified, + delegate.xtags, + delegate.startTimeMs, + delegate.durationMs, + delegate.startSegmentIndex, + delegate.endSegmentIndex, + delegate.timescale, + ).also { it.delegate = delegate } + } +} diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrRequest.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrRequest.kt new file mode 100644 index 00000000..b7685c29 --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrRequest.kt @@ -0,0 +1,29 @@ +package dev.typetype.server.sabr + +import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest as PipeRequest + +internal class SabrSegmentRequest private constructor( + val format: YoutubeSabrFormat, + val isInitializationSegment: Boolean, + val sequenceNumber: Int, + private val delegateFactory: () -> PipeRequest, +) { + private val delegateValue: PipeRequest by lazy(LazyThreadSafetyMode.SYNCHRONIZED, delegateFactory) + + internal val delegate: PipeRequest + get() = delegateValue + + companion object { + fun initialization(format: YoutubeSabrFormat): SabrSegmentRequest = + SabrSegmentRequest(format, true, -1) { + PipeRequest.initialization(format.delegate) + } + + fun media(format: YoutubeSabrFormat, sequenceNumber: Int): SabrSegmentRequest = + SabrSegmentRequest(format, false, sequenceNumber) { + PipeRequest.media(format.delegate, sequenceNumber) + }.also { + require(sequenceNumber > 0) { "SABR media sequence number must be positive" } + } + } +} diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrTokenProvider.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrTokenProvider.kt new file mode 100644 index 00000000..2d06cfb3 --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrTokenProvider.kt @@ -0,0 +1,5 @@ +package dev.typetype.server.sabr + +internal fun interface SabrPoTokenProvider { + fun getPoToken(info: YoutubeSabrInfo, streamState: YoutubeSabrStreamState): ByteArray? +} From 02c3621542d35ea013d9b146c2e1c8d3a4a2159f Mon Sep 17 00:00:00 2001 From: Priveetee Date: Fri, 4 Sep 2026 11:43:50 +0200 Subject: [PATCH 05/12] refactor: add TypeType SABR session adapter --- .../dev/typetype/server/sabr/SabrAdapter.kt | 62 +++++++++++++ .../dev/typetype/server/sabr/SabrSession.kt | 89 +++++++++++++++++++ .../typetype/server/sabr/SabrStreamState.kt | 82 +++++++++++++++++ 3 files changed, 233 insertions(+) create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrAdapter.kt create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrSession.kt create mode 100644 src/main/kotlin/dev/typetype/server/sabr/SabrStreamState.kt diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrAdapter.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrAdapter.kt new file mode 100644 index 00000000..3ec926d3 --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrAdapter.kt @@ -0,0 +1,62 @@ +package dev.typetype.server.sabr + +import com.grack.nanojson.JsonObject +import org.schabi.newpipe.extractor.localization.ContentCountry +import org.schabi.newpipe.extractor.localization.Localization +import org.schabi.newpipe.extractor.services.youtube.sabr.TypeTypeYoutubeSabrInfoFactory +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrProbe + +/** The only server entry point for PipePipe's SABR extraction API. */ +internal object SabrAdapter { + fun fetchSabrInfo( + videoId: String, + profile: YoutubeSabrClientProfile, + localization: Localization, + contentCountry: ContentCountry, + ): YoutubeSabrInfo = YoutubeSabrInfo( + YoutubeSabrProbe.fetchSabrInfo(videoId, profile.delegate, localization, contentCountry), + ) + + fun fetchSabrInfo( + videoId: String, + profile: YoutubeSabrClientProfile, + localization: Localization, + contentCountry: ContentCountry, + poToken: String, + visitorData: String?, + ): YoutubeSabrInfo = YoutubeSabrInfo( + YoutubeSabrProbe.fetchSabrInfo( + videoId, + profile.delegate, + localization, + contentCountry, + poToken, + visitorData, + ), + ) + + fun fromPlayerResponse( + videoId: String, + profile: YoutubeSabrClientProfile, + cpn: String, + response: JsonObject, + ): YoutubeSabrInfo = YoutubeSabrInfo( + YoutubeSabrProbe.fromPlayerResponse(videoId, profile.delegate, cpn, response), + ) + + fun withPlaybackIdentity( + info: YoutubeSabrInfo, + playbackUrl: String, + clientVersion: String, + cpn: String, + visitorData: String?, + ): YoutubeSabrInfo = YoutubeSabrInfo( + TypeTypeYoutubeSabrInfoFactory.withPlaybackIdentity( + info.delegate, + playbackUrl, + clientVersion, + cpn, + visitorData, + ), + ) +} diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrSession.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrSession.kt new file mode 100644 index 00000000..314820ae --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrSession.kt @@ -0,0 +1,89 @@ +package dev.typetype.server.sabr + +import org.schabi.newpipe.extractor.localization.Localization +import org.schabi.newpipe.extractor.services.youtube.sabr.SabrPoTokenProvider as PipeProvider +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo as PipeInfo +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession as PipeSession +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState as PipeState + +internal class YoutubeSabrSession( + info: YoutubeSabrInfo, + audioFormat: YoutubeSabrFormat, + videoFormat: YoutubeSabrFormat, + poTokenProvider: SabrPoTokenProvider, +) { + private val delegate = PipeSession( + info.delegate, + audioFormat.delegate, + videoFormat.delegate, + object : PipeProvider { + override fun getPoToken(pipeInfo: PipeInfo, pipeState: PipeState): ByteArray? = + poTokenProvider.getPoToken(YoutubeSabrInfo(pipeInfo), YoutubeSabrStreamState.fromDelegate(pipeState)) + }, + ) + val streamState: YoutubeSabrStreamState = YoutubeSabrStreamState.fromDelegate(delegate.streamState) + + fun fetchSegment(request: SabrSegmentRequest, localization: Localization): SabrMediaSegment? = + SabrMediaSegment.fromDelegate(delegate.fetchSegment(request.delegate, localization)) + + fun addDiagnosticEvent(event: String): Unit = delegate.addDiagnosticEvent(event) + val diagnosticTrace: String get() = delegate.diagnosticTrace + fun pumpOnce(localization: Localization): List = + delegate.pumpOnce(localization).map(SabrMediaSegment::fromDelegate) + fun pumpOnceStreaming(localization: Localization): Int = delegate.pumpOnceStreaming(localization) + fun pumpOnceStreamingForStartup(localization: Localization): Int = + delegate.pumpOnceStreamingForStartup(localization) + fun pumpOnceStreamingUntilCached(localization: Localization, target: SabrSegmentRequest): Int = + delegate.pumpOnceStreamingUntilCached(localization, target.delegate) + fun pumpOnceStreamingForDemand(localization: Localization, target: SabrSegmentRequest): DemandResponseResult = + delegate.pumpOnceStreamingForDemand(localization, target.delegate).let(::DemandResponseResult) + val demandBackoffRemainingMs: Long get() = delegate.demandBackoffRemainingMs + val mediaProgressVersion: Long get() = delegate.mediaProgressVersion + fun setPlayHeadMs(value: Long): Unit = delegate.setPlayHeadMs(value) + val cachedBytes: Long get() = delegate.cachedBytes + val peakCachedBytes: Long get() = delegate.peakCachedBytes + val totalResponseBytes: Long get() = delegate.totalResponseBytes + val maxResponseBytes: Long get() = delegate.maxResponseBytes + val maxUmpPartBytes: Long get() = delegate.maxUmpPartBytes + val maxMediaPartPayloadBytes: Long get() = delegate.maxMediaPartPayloadBytes + val maxSegmentBytes: Long get() = delegate.maxSegmentBytes + val maxSegmentsPerResponse: Int get() = delegate.maxSegmentsPerResponse + val maxStreamProtectionStatus: Int get() = delegate.maxStreamProtectionStatus + val memoryDiagnosticSummary: String get() = delegate.memoryDiagnosticSummary + fun clearCache(): Unit = delegate.clearCache() + fun evictPlayed(): Unit = delegate.evictPlayed() + fun getCachedSegment(request: SabrSegmentRequest): SabrMediaSegment? = + delegate.getCachedSegment(request.delegate)?.let(SabrMediaSegment::fromDelegate) + fun getReadableSegment(request: SabrSegmentRequest): SabrMediaSegment? = + delegate.getReadableSegment(request.delegate)?.let(SabrMediaSegment::fromDelegate) + fun awaitCachedSegment(request: SabrSegmentRequest, timeoutMs: Long): SabrMediaSegment? = + delegate.awaitCachedSegment(request.delegate, timeoutMs)?.let(SabrMediaSegment::fromDelegate) + fun awaitReadableSegment(request: SabrSegmentRequest, timeoutMs: Long): SabrMediaSegment? = + delegate.awaitReadableSegment(request.delegate, timeoutMs)?.let(SabrMediaSegment::fromDelegate) + fun discardCachedSegment(request: SabrSegmentRequest): Unit = delegate.discardCachedSegment(request.delegate) + fun setTraceEnabled(value: Boolean): Unit = delegate.setTraceEnabled(value) + fun isBeyondEnd(request: SabrSegmentRequest): Boolean = delegate.isBeyondEnd(request.delegate) + val isComplete: Boolean get() = delegate.isComplete + val isLive: Boolean get() = delegate.isLive + val liveHeadSequenceNumber: Long get() = delegate.liveHeadSequenceNumber + val isAtLiveEdge: Boolean get() = delegate.isAtLiveEdge + val requestNumber: Int get() = delegate.requestNumber + val sessionPolicyTranscript: List get() = delegate.sessionPolicyTranscript + fun prepareForMediaSegment(request: SabrSegmentRequest): Unit = delegate.prepareForMediaSegment(request.delegate) + fun prepareForInitialization(format: YoutubeSabrFormat): Unit = delegate.prepareForInitialization(format.delegate) + fun bootstrapInitialization(localization: Localization): Unit = delegate.bootstrapInitialization(localization) + fun fetchInitializationData(format: YoutubeSabrFormat, localization: Localization, timeoutMs: Long, poToken: ByteArray): ByteArray = + delegate.fetchInitializationData(format.delegate, localization, timeoutMs, poToken) + fun prepareForRewind(request: SabrSegmentRequest): Unit = delegate.prepareForRewind(request.delegate) + fun prepareForRewind(request: SabrSegmentRequest, value: Long): Unit = delegate.prepareForRewind(request.delegate, value) + fun prepareForForwardJump(request: SabrSegmentRequest): Unit = delegate.prepareForForwardJump(request.delegate) + fun prepareForForwardJump(request: SabrSegmentRequest, value: Long): Unit = delegate.prepareForForwardJump(request.delegate, value) + fun prepareForMissingSegment(request: SabrSegmentRequest): Unit = delegate.prepareForMissingSegment(request.delegate) + + internal class DemandResponseResult internal constructor( + private val delegate: PipeSession.DemandResponseResult, + ) { + val segmentCount: Int get() = delegate.segmentCount + val targetTrackSegmentCount: Int get() = delegate.targetTrackSegmentCount + } +} diff --git a/src/main/kotlin/dev/typetype/server/sabr/SabrStreamState.kt b/src/main/kotlin/dev/typetype/server/sabr/SabrStreamState.kt new file mode 100644 index 00000000..5689bd70 --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/sabr/SabrStreamState.kt @@ -0,0 +1,82 @@ +package dev.typetype.server.sabr + +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState as PipeState + +internal class YoutubeSabrStreamState private constructor( + internal val delegate: PipeState, +) { + companion object { + const val TRACK_MODE_VIDEO_AND_AUDIO: Int = PipeState.TRACK_MODE_VIDEO_AND_AUDIO + const val TRACK_MODE_AUDIO_ONLY: Int = PipeState.TRACK_MODE_AUDIO_ONLY + const val TRACK_MODE_VIDEO_ONLY: Int = PipeState.TRACK_MODE_VIDEO_ONLY + internal fun fromDelegate(delegate: PipeState): YoutubeSabrStreamState = YoutubeSabrStreamState(delegate) + } + + constructor(audio: YoutubeSabrFormat, video: YoutubeSabrFormat) : this(PipeState(audio.delegate, video.delegate)) + + fun ingest(segment: SabrMediaSegment): Boolean = delegate.ingest(segment.delegate) + fun ingestInitializationData(format: YoutubeSabrFormat, data: ByteArray): Boolean = + delegate.ingestInitializationData(format.delegate, data) + val bufferedRanges: List + get() = delegate.bufferedRanges.map(SabrBufferedRange::fromDelegate) + fun setBufferedRangesOverride(ranges: List?): Unit = + delegate.setBufferedRangesOverride(ranges?.map { it.delegate }) + val playerTimeMs: Long get() = delegate.playerTimeMs + fun getMinBufferedEndMs(): Long = delegate.minBufferedEndMs + fun getBufferedEndMs(format: YoutubeSabrFormat): Long = delegate.getBufferedEndMs(format.delegate) + fun setPlayerTimeMs(value: Long): Unit = delegate.setPlayerTimeMs(value) + fun clearPlayerTimeMsOverride(): Unit = delegate.clearPlayerTimeMsOverride() + val playbackCookie: ByteArray? get() = delegate.playbackCookie + fun setPoToken(value: ByteArray): Unit = delegate.setPoToken(value) + val poToken: ByteArray? get() = delegate.poToken + val isComplete: Boolean get() = delegate.isComplete + val isLive: Boolean get() = delegate.isLive + val isPostLiveDvr: Boolean get() = delegate.isPostLiveDvr + val liveHeadSequenceNumber: Long get() = delegate.liveHeadSequenceNumber + val liveHeadTimeMs: Long get() = delegate.liveHeadTimeMs + fun isAtLiveEdge(audio: YoutubeSabrFormat, video: YoutubeSabrFormat): Boolean = + delegate.isAtLiveEdge(audio.delegate, video.delegate) + fun getMaxSegment(format: YoutubeSabrFormat): Int = delegate.getMaxSegment(format.delegate) + fun getEndSegment(format: YoutubeSabrFormat): Long = delegate.getEndSegment(format.delegate) + fun hasSegmentIndex(format: YoutubeSabrFormat): Boolean = delegate.hasSegmentIndex(format.delegate) + fun isComplete(format: YoutubeSabrFormat): Boolean = delegate.isComplete(format.delegate) + fun assumeBufferedUntil(format: YoutubeSabrFormat, segment: Int): Unit = delegate.assumeBufferedUntil(format.delegate, segment) + fun rewindBufferedTo(format: YoutubeSabrFormat, segment: Int): Unit = delegate.rewindBufferedTo(format.delegate, segment) + fun jumpBufferedTo(format: YoutubeSabrFormat, segment: Int): Unit = delegate.jumpBufferedTo(format.delegate, segment) + fun setFullyBuffered(format: YoutubeSabrFormat, value: Boolean): Unit = delegate.setFullyBuffered(format.delegate, value) + fun setLastOnlyRange(format: YoutubeSabrFormat, value: Boolean): Unit = delegate.setLastOnlyRange(format.delegate, value) + fun setLastOnlyRangesUseObservedTiming(value: Boolean): Unit = delegate.setLastOnlyRangesUseObservedTiming(value) + fun setBufferedRangeSegmentIndexOffset(value: Int): Unit = delegate.setBufferedRangeSegmentIndexOffset(value) + fun setBufferedRangeSegmentIndexOffsets(audio: Int, video: Int): Unit = delegate.setBufferedRangeSegmentIndexOffsets(audio, video) + fun setRequestTrackMode(mode: Int, audio: Boolean, video: Boolean): Unit = delegate.setRequestTrackMode(mode, audio, video) + fun setActiveTrackTypes(video: Boolean, audio: Boolean): Unit = delegate.setActiveTrackTypes(video, audio) + fun setAudioOnlyRequestMode(): Unit = delegate.setAudioOnlyRequestMode() + fun setVideoOnlyRequestMode(): Unit = delegate.setVideoOnlyRequestMode() + fun setVideoAndAudioRequestMode(): Unit = delegate.setVideoAndAudioRequestMode() + fun setClientViewport(width: Int, height: Int): Unit = delegate.setClientViewport(width, height) + fun setBandwidthEstimate(value: Long): Unit = delegate.setBandwidthEstimate(value) + val bandwidthEstimate: Long get() = delegate.bandwidthEstimate + val nextRequestPolicy: SabrNextRequestPolicy? + get() = delegate.nextRequestPolicy?.let(::SabrNextRequestPolicy) + fun setPlaybackRate(value: Float): Unit = delegate.setPlaybackRate(value) + fun setWriteTopLevelPlayerTimeMs(value: Boolean): Unit = delegate.setWriteTopLevelPlayerTimeMs(value) + fun setClientAbrVisibility(value: Int?): Unit = delegate.setClientAbrVisibility(value) + fun setWriteLastManualSelectedResolution(value: Boolean): Unit = delegate.setWriteLastManualSelectedResolution(value) + fun setWriteAllPreferredFormats(value: Boolean): Unit = delegate.setWriteAllPreferredFormats(value) + fun setWriteOfficialWebPreferredFormats(value: Boolean): Unit = delegate.setWriteOfficialWebPreferredFormats(value) + fun setSelectVideoFormatBeforeAudio(value: Boolean): Unit = delegate.setSelectVideoFormatBeforeAudio(value) + fun setWriteBufferedRangeTimeRange(value: Boolean): Unit = delegate.setWriteBufferedRangeTimeRange(value) + fun setStickyResolutionOverride(value: Int?): Unit = delegate.setStickyResolutionOverride(value) + fun setOfficialWebClientAbrTimingOverrides(a: Long?, b: Long?, c: Long?, d: Long?): Unit = + delegate.setOfficialWebClientAbrTimingOverrides(a, b, c, d) + fun setOfficialField68Override(value: Long?): Unit = delegate.setOfficialField68Override(value) + fun setSabrReportRequestCancellationInfoOverride(value: Int?): Unit = + delegate.setSabrReportRequestCancellationInfoOverride(value) + fun setWriteOfficialWebClientAbrFields(value: Boolean): Unit = delegate.setWriteOfficialWebClientAbrFields(value) + fun summarizeBufferedRanges(): String = delegate.summarizeBufferedRanges() + fun getAverageSegmentDurationMs(format: YoutubeSabrFormat): Long = delegate.getAverageSegmentDurationMs(format.delegate) + fun getSegmentStartMs(format: YoutubeSabrFormat, sequence: Int): Long = delegate.getSegmentStartMs(format.delegate, sequence) + fun getSegmentEndMs(format: YoutubeSabrFormat, sequence: Int): Long = delegate.getSegmentEndMs(format.delegate, sequence) + fun getSegmentNumberAtOrAfterTimeMs(format: YoutubeSabrFormat, timeMs: Long): Int = + delegate.getSegmentNumberAtOrAfterTimeMs(format.delegate, timeMs) +} From 41a16fd4495f5c592f7c92cd1ac9d2fef65487d0 Mon Sep 17 00:00:00 2001 From: Priveetee Date: Fri, 4 Sep 2026 11:43:58 +0200 Subject: [PATCH 06/12] refactor: route Server SABR code through adapter --- build.gradle.kts | 2 +- .../dev/typetype/server/routes/SabrFormatSelector.kt | 6 +++--- .../dev/typetype/server/routes/SabrManifestHandler.kt | 2 +- .../typetype/server/routes/SabrManifestResponse.kt | 2 +- .../dev/typetype/server/routes/SabrPlaybackHandler.kt | 2 +- .../dev/typetype/server/routes/SabrPlaybackModels.kt | 2 +- .../server/routes/SabrPlaybackStateHandler.kt | 2 +- .../server/routes/SabrPlaybackWindowBuilder.kt | 4 ++-- .../server/routes/SabrPlaybackWindowHandler.kt | 2 +- .../server/routes/SabrPlaybackWindowSegmentTiming.kt | 4 ++-- .../server/routes/SabrPlaybackWindowTiming.kt | 2 +- .../server/routes/SabrProgressivePlaybackWindow.kt | 6 +++--- .../dev/typetype/server/routes/SabrSegmentHandler.kt | 2 +- .../server/routes/SabrSessionDescriptorHandler.kt | 2 +- .../typetype/server/routes/SabrSessionStateHandler.kt | 4 ++-- .../server/routes/SabrStreamContractFilter.kt | 4 ++-- .../server/services/AuthenticatedSabrInfoService.kt | 8 ++++---- .../dev/typetype/server/services/CachedSabrSegment.kt | 2 +- .../typetype/server/services/PipePipeStreamService.kt | 2 +- .../server/services/SabrAdaptiveInitialization.kt | 2 +- .../server/services/SabrCachedSegmentLocator.kt | 8 ++++---- .../server/services/SabrDashManifestBuilder.kt | 4 ++-- .../server/services/SabrDemandAttemptFinisher.kt | 6 +++--- .../server/services/SabrDownloadInitialization.kt | 2 +- .../dev/typetype/server/services/SabrDownloadRange.kt | 4 ++-- .../typetype/server/services/SabrDownloadStreamer.kt | 4 ++-- .../server/services/SabrFallbackStreamMapper.kt | 4 ++-- .../server/services/SabrHlsManifestBuilder.kt | 4 ++-- .../server/services/SabrInFlightDemandTracker.kt | 2 +- .../dev/typetype/server/services/SabrInfoFetcher.kt | 6 +++--- .../typetype/server/services/SabrInfoRepository.kt | 4 ++-- .../typetype/server/services/SabrInfoSharedCache.kt | 2 +- .../server/services/SabrInitializationData.kt | 4 ++-- .../server/services/SabrInitializationPolicy.kt | 2 +- .../services/SabrInitializationSegmentFetcher.kt | 4 ++-- .../server/services/SabrLiveContinuationRequest.kt | 4 ++-- .../dev/typetype/server/services/SabrLivePlayback.kt | 6 +++--- .../server/services/SabrLivePlaybackDiscontinuity.kt | 4 ++-- .../dev/typetype/server/services/SabrLivePumpStep.kt | 6 +++--- .../typetype/server/services/SabrLiveWarmupRequest.kt | 6 +++--- .../typetype/server/services/SabrManifestBuilder.kt | 4 ++-- .../typetype/server/services/SabrManifestTiming.kt | 4 ++-- .../typetype/server/services/SabrMimeAttributes.kt | 2 +- .../dev/typetype/server/services/SabrPendingSeek.kt | 2 +- .../services/SabrPlaybackCachedSegmentLocator.kt | 4 ++-- .../server/services/SabrPlaybackDiagnostics.kt | 4 ++-- .../server/services/SabrPlaybackManifestService.kt | 2 +- .../server/services/SabrPlaybackMediaFetcher.kt | 4 ++-- .../server/services/SabrPlaybackSegmentResult.kt | 2 +- .../server/services/SabrPlaybackSegmentSelection.kt | 2 +- .../server/services/SabrPlaybackSessionService.kt | 4 ++-- .../typetype/server/services/SabrPlaybackStarter.kt | 2 +- .../typetype/server/services/SabrPlaybackWarmer.kt | 2 +- .../server/services/SabrPlayerContextRecovery.kt | 6 +++--- .../typetype/server/services/SabrPlayerInfoProbe.kt | 8 ++++---- .../dev/typetype/server/services/SabrPreparedInfo.kt | 2 +- .../dev/typetype/server/services/SabrPumpLogger.kt | 2 +- .../dev/typetype/server/services/SabrSegmentCache.kt | 6 +++--- .../server/services/SabrSegmentDemandResolution.kt | 4 ++-- .../server/services/SabrSegmentDemandTracker.kt | 2 +- .../typetype/server/services/SabrSessionFactory.kt | 6 +++--- .../dev/typetype/server/services/SabrSessionHolder.kt | 10 +++++----- .../typetype/server/services/SabrSessionIdentity.kt | 6 +++--- .../server/services/SabrSessionMediaFetcher.kt | 4 ++-- .../server/services/SabrSessionPlayerContext.kt | 2 +- .../typetype/server/services/SabrSessionProgress.kt | 4 ++-- .../dev/typetype/server/services/SabrSessionPump.kt | 4 ++-- .../typetype/server/services/SabrSessionPumpLoop.kt | 8 ++++---- .../dev/typetype/server/services/SabrSessionStore.kt | 8 ++++---- .../server/services/SabrSessionTimeRequests.kt | 4 ++-- .../dev/typetype/server/services/SabrTargetRequest.kt | 6 +++--- .../server/services/SabrTargetRequestShape.kt | 8 ++++---- .../dev/typetype/server/services/SabrTokenBundle.kt | 2 +- .../services/SabrUnauthorizedResponseRecovery.kt | 2 +- .../server/services/SabrWindowSegmentFetcher.kt | 4 ++-- .../typetype/server/services/TokenYoutubeSession.kt | 2 +- .../services/TypetypeTokenSabrPoTokenProvider.kt | 8 ++++---- .../services/TypetypeTokenYoutubeSessionClient.kt | 11 +++++------ 78 files changed, 157 insertions(+), 158 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 620ef3ae..9789023e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -44,7 +44,7 @@ dependencies { implementation("io.ktor:ktor-server-call-logging-jvm") implementation("io.ktor:ktor-server-rate-limit-jvm") implementation("ch.qos.logback:logback-classic:1.6.3") - implementation("com.github.Priveetee.PipePipeExtractor:extractor:f156813dd4bbebf3b4dffe541fee6c27ae1dd294") + implementation("com.github.Priveetee.PipePipeExtractor:extractor:ca3280f28f3aa0b980b63a2b2d23c362f7616620") compileOnly("com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751") implementation("org.json:json:20260814") implementation("com.squareup.okhttp3:okhttp:5.5.0") diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrFormatSelector.kt b/src/main/kotlin/dev/typetype/server/routes/SabrFormatSelector.kt index 1e8e5cdc..bfb3a215 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrFormatSelector.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrFormatSelector.kt @@ -1,7 +1,7 @@ package dev.typetype.server.routes -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo internal object SabrFormatSelector { fun video(info: YoutubeSabrInfo, itag: Int?): YoutubeSabrFormat? { @@ -23,7 +23,7 @@ internal object SabrFormatSelector { } private fun YoutubeSabrFormat.matchesAudio(itag: Int?, trackId: String?, requireAac: Boolean): Boolean = - itag != null && isAudio && getItag() == itag && (!requireAac || isAac()) && + itag != null && isAudio && this.itag == itag && (!requireAac || isAac()) && (trackId.isNullOrBlank() || audioTrackId == trackId) private fun YoutubeSabrFormat.isAac(): Boolean = diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrManifestHandler.kt b/src/main/kotlin/dev/typetype/server/routes/SabrManifestHandler.kt index f24a01e4..b98707ce 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrManifestHandler.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrManifestHandler.kt @@ -13,7 +13,7 @@ import dev.typetype.server.services.SabrSessionPurpose import dev.typetype.server.services.SabrSessionStore import dev.typetype.server.services.StreamService import dev.typetype.server.services.bothFormatsKnown -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat import io.ktor.http.HttpStatusCode import io.ktor.server.application.ApplicationCall import io.ktor.server.response.respond diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrManifestResponse.kt b/src/main/kotlin/dev/typetype/server/routes/SabrManifestResponse.kt index 329c4a13..faa2ebb0 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrManifestResponse.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrManifestResponse.kt @@ -58,7 +58,7 @@ internal suspend fun ApplicationCall.respondSabrManifest( respondText(manifest, if (hls) HLS_CONTENT_TYPE else DASH_CONTENT_TYPE) } -private fun SabrSessionHolder.startSegment(format: org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat): Int = +private fun SabrSessionHolder.startSegment(format: dev.typetype.server.sabr.YoutubeSabrFormat): Int = key.startTimeMs.takeIf { it > 0L } ?.let { playbackStartSequence(format, it) } ?: 1 diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackHandler.kt b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackHandler.kt index 6326898a..7f7f26dc 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackHandler.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackHandler.kt @@ -19,7 +19,7 @@ import io.ktor.http.HttpStatusCode import io.ktor.server.application.ApplicationCall import io.ktor.server.request.receive import io.ktor.server.response.respond -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat internal class SabrPlaybackHandler( private val sabrSessionStore: SabrSessionStore, diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackModels.kt b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackModels.kt index c4ddf65c..c9ee7140 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackModels.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackModels.kt @@ -1,7 +1,7 @@ package dev.typetype.server.routes import kotlinx.serialization.Serializable -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrSegmentRequest @Serializable internal data class SabrPlaybackRequest( diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackStateHandler.kt b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackStateHandler.kt index a5b8f07b..a51e3cd4 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackStateHandler.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackStateHandler.kt @@ -8,7 +8,7 @@ import dev.typetype.server.services.livePlaybackSnapshot import io.ktor.http.HttpStatusCode import io.ktor.server.application.ApplicationCall import io.ktor.server.response.respond -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrSegmentRequest internal class SabrPlaybackStateHandler(private val sabrSessionStore: SabrSessionStore) { suspend fun get(call: ApplicationCall, sessionId: String) { diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowBuilder.kt b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowBuilder.kt index 56dd5c8d..183a4a76 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowBuilder.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowBuilder.kt @@ -12,8 +12,8 @@ import dev.typetype.server.services.livePlaybackSnapshot import dev.typetype.server.services.playbackContinuationSequence import dev.typetype.server.services.playbackSegmentStartMs import dev.typetype.server.services.resolvePlaybackStartMs -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat private const val MAX_SEGMENTS_PER_TRACK = 12 diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowHandler.kt b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowHandler.kt index 52d4d2c9..64241f07 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowHandler.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowHandler.kt @@ -12,7 +12,7 @@ import io.ktor.http.HttpStatusCode import io.ktor.server.application.ApplicationCall import io.ktor.server.request.receive import io.ktor.server.response.respond -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrSegmentRequest internal class SabrPlaybackWindowHandler(private val sabrSessionStore: SabrSessionStore) { private val windowBuilder = SabrPlaybackWindowBuilder(sabrSessionStore) diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowSegmentTiming.kt b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowSegmentTiming.kt index d1174456..cd96e1fd 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowSegmentTiming.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowSegmentTiming.kt @@ -4,8 +4,8 @@ import dev.typetype.server.services.CachedSabrSegment import dev.typetype.server.services.SabrSessionHolder import dev.typetype.server.services.SabrSessionStore import dev.typetype.server.services.playbackSegmentDurationMs -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat internal suspend fun SabrSessionStore.resolvePlaybackDurationMs( holder: SabrSessionHolder, diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowTiming.kt b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowTiming.kt index c186a231..9d0aee52 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowTiming.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrPlaybackWindowTiming.kt @@ -4,7 +4,7 @@ import dev.typetype.server.services.CachedSabrSegment import dev.typetype.server.services.SabrSessionHolder import dev.typetype.server.services.livePlaybackSnapshot import dev.typetype.server.services.playbackSegmentDurationMs -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat internal fun SabrSessionHolder.durationMs(): Long { livePlaybackSnapshot()?.let { live -> diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrProgressivePlaybackWindow.kt b/src/main/kotlin/dev/typetype/server/routes/SabrProgressivePlaybackWindow.kt index 35b977e6..5ae51fb1 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrProgressivePlaybackWindow.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrProgressivePlaybackWindow.kt @@ -4,9 +4,9 @@ import dev.typetype.server.services.SabrSessionHolder import dev.typetype.server.services.findCachedMediaAt import dev.typetype.server.services.playbackSegmentDurationMs import dev.typetype.server.services.playbackSegmentStartMs -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat internal data class SabrProgressiveWindowSegment( val sequence: Int, diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrSegmentHandler.kt b/src/main/kotlin/dev/typetype/server/routes/SabrSegmentHandler.kt index 8b2de3a3..069c09d6 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrSegmentHandler.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrSegmentHandler.kt @@ -11,7 +11,7 @@ import io.ktor.server.application.ApplicationCall import io.ktor.server.response.respond import kotlinx.coroutines.delay import kotlinx.coroutines.withTimeoutOrNull -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrSegmentRequest internal class SabrSegmentHandler( private val sabrSessionStore: SabrSessionStore, diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrSessionDescriptorHandler.kt b/src/main/kotlin/dev/typetype/server/routes/SabrSessionDescriptorHandler.kt index 92302fa3..acd908d5 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrSessionDescriptorHandler.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrSessionDescriptorHandler.kt @@ -16,7 +16,7 @@ import kotlinx.coroutines.withTimeoutOrNull import kotlinx.serialization.json.buildJsonObject import kotlinx.serialization.json.put import kotlinx.serialization.json.putJsonObject -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat import kotlin.math.max internal class SabrSessionDescriptorHandler( diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrSessionStateHandler.kt b/src/main/kotlin/dev/typetype/server/routes/SabrSessionStateHandler.kt index d68583b8..0dcb823a 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrSessionStateHandler.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrSessionStateHandler.kt @@ -16,8 +16,8 @@ import kotlinx.serialization.json.longOrNull import kotlinx.serialization.json.doubleOrNull import kotlinx.serialization.json.put import kotlinx.serialization.json.putJsonObject -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat internal class SabrSessionStateHandler(private val sabrSessionStore: SabrSessionStore) { suspend fun get(call: ApplicationCall, videoId: String) { diff --git a/src/main/kotlin/dev/typetype/server/routes/SabrStreamContractFilter.kt b/src/main/kotlin/dev/typetype/server/routes/SabrStreamContractFilter.kt index de4379d2..f966d9a4 100644 --- a/src/main/kotlin/dev/typetype/server/routes/SabrStreamContractFilter.kt +++ b/src/main/kotlin/dev/typetype/server/routes/SabrStreamContractFilter.kt @@ -4,8 +4,8 @@ import dev.typetype.server.models.AudioStreamItem import dev.typetype.server.models.StreamResponse import dev.typetype.server.models.VideoStreamItem import dev.typetype.server.services.SabrSessionStore -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo internal suspend fun StreamResponse.withPlayableSabrStreams( url: String, diff --git a/src/main/kotlin/dev/typetype/server/services/AuthenticatedSabrInfoService.kt b/src/main/kotlin/dev/typetype/server/services/AuthenticatedSabrInfoService.kt index 66ecdecc..1768eaec 100644 --- a/src/main/kotlin/dev/typetype/server/services/AuthenticatedSabrInfoService.kt +++ b/src/main/kotlin/dev/typetype/server/services/AuthenticatedSabrInfoService.kt @@ -8,9 +8,9 @@ import kotlinx.coroutines.runInterruptible import org.schabi.newpipe.extractor.localization.ContentCountry import org.schabi.newpipe.extractor.localization.Localization import org.schabi.newpipe.extractor.services.youtube.YoutubeSessionPoToken -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrProbe +import dev.typetype.server.sabr.YoutubeSabrClientProfile +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.SabrAdapter import org.slf4j.LoggerFactory internal class AuthenticatedSabrInfoService( @@ -87,7 +87,7 @@ private object PipePipeAuthenticatedSabrProbe : AuthenticatedSabrProbe { private val contentCountry = ContentCountry("US") override fun fetch(videoId: String, token: YoutubeSessionPoToken): YoutubeSabrInfo = - YoutubeSabrProbe.fetchSabrInfo( + SabrAdapter.fetchSabrInfo( videoId, YoutubeSabrClientProfile.WEB, localization, diff --git a/src/main/kotlin/dev/typetype/server/services/CachedSabrSegment.kt b/src/main/kotlin/dev/typetype/server/services/CachedSabrSegment.kt index c92342dc..443c6b6d 100644 --- a/src/main/kotlin/dev/typetype/server/services/CachedSabrSegment.kt +++ b/src/main/kotlin/dev/typetype/server/services/CachedSabrSegment.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrMediaSegment import java.util.Base64 internal class CachedSabrSegment( diff --git a/src/main/kotlin/dev/typetype/server/services/PipePipeStreamService.kt b/src/main/kotlin/dev/typetype/server/services/PipePipeStreamService.kt index 011f4d46..85209166 100644 --- a/src/main/kotlin/dev/typetype/server/services/PipePipeStreamService.kt +++ b/src/main/kotlin/dev/typetype/server/services/PipePipeStreamService.kt @@ -15,7 +15,7 @@ import org.schabi.newpipe.extractor.NewPipe import org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability import org.schabi.newpipe.extractor.sponsorblock.SponsorBlockApiSettings import org.schabi.newpipe.extractor.sponsorblock.SponsorBlockExtractorHelper -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrInfo import org.schabi.newpipe.extractor.stream.StreamExtractor import org.schabi.newpipe.extractor.stream.StreamInfo diff --git a/src/main/kotlin/dev/typetype/server/services/SabrAdaptiveInitialization.kt b/src/main/kotlin/dev/typetype/server/services/SabrAdaptiveInitialization.kt index de684c89..70b2e088 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrAdaptiveInitialization.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrAdaptiveInitialization.kt @@ -4,7 +4,7 @@ import dev.typetype.server.cache.CacheService import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runInterruptible import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat internal object SabrAdaptiveInitialization { private val localization = Localization("en", "US") diff --git a/src/main/kotlin/dev/typetype/server/services/SabrCachedSegmentLocator.kt b/src/main/kotlin/dev/typetype/server/services/SabrCachedSegmentLocator.kt index 7862aaad..a532cdfd 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrCachedSegmentLocator.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrCachedSegmentLocator.kt @@ -1,9 +1,9 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrSession internal fun YoutubeSabrSession.findCachedMediaAt( format: YoutubeSabrFormat, diff --git a/src/main/kotlin/dev/typetype/server/services/SabrDashManifestBuilder.kt b/src/main/kotlin/dev/typetype/server/services/SabrDashManifestBuilder.kt index a53a3aa7..6c443d75 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrDashManifestBuilder.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrDashManifestBuilder.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrStreamState internal object SabrDashManifestBuilder { fun build( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrDemandAttemptFinisher.kt b/src/main/kotlin/dev/typetype/server/services/SabrDemandAttemptFinisher.kt index 3e733749..e4eccca5 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrDemandAttemptFinisher.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrDemandAttemptFinisher.kt @@ -1,8 +1,8 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrSession internal object SabrDemandAttemptFinisher { fun interruptCompletedInFlightDemand(holder: SabrSessionHolder, demand: SabrInFlightDemand): Boolean = diff --git a/src/main/kotlin/dev/typetype/server/services/SabrDownloadInitialization.kt b/src/main/kotlin/dev/typetype/server/services/SabrDownloadInitialization.kt index 62f296e5..f4ed0722 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrDownloadInitialization.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrDownloadInitialization.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat internal object SabrDownloadInitialization { suspend fun fetch( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrDownloadRange.kt b/src/main/kotlin/dev/typetype/server/services/SabrDownloadRange.kt index 5117cc1b..f5f80626 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrDownloadRange.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrDownloadRange.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrStreamState internal data class SabrDownloadRange( val part: Int = 0, diff --git a/src/main/kotlin/dev/typetype/server/services/SabrDownloadStreamer.kt b/src/main/kotlin/dev/typetype/server/services/SabrDownloadStreamer.kt index 15c3ed98..16fdcc33 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrDownloadStreamer.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrDownloadStreamer.kt @@ -6,8 +6,8 @@ import kotlinx.coroutines.runInterruptible import kotlinx.coroutines.withContext import kotlinx.coroutines.withTimeoutOrNull import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat import org.slf4j.LoggerFactory import java.io.IOException import java.io.OutputStream diff --git a/src/main/kotlin/dev/typetype/server/services/SabrFallbackStreamMapper.kt b/src/main/kotlin/dev/typetype/server/services/SabrFallbackStreamMapper.kt index 5b8f0151..305edca5 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrFallbackStreamMapper.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrFallbackStreamMapper.kt @@ -3,8 +3,8 @@ package dev.typetype.server.services import dev.typetype.server.models.AudioStreamItem import dev.typetype.server.models.StreamResponse import dev.typetype.server.models.VideoStreamItem -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo import java.net.URLEncoder import java.nio.charset.StandardCharsets diff --git a/src/main/kotlin/dev/typetype/server/services/SabrHlsManifestBuilder.kt b/src/main/kotlin/dev/typetype/server/services/SabrHlsManifestBuilder.kt index 652e7161..2ef01b4d 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrHlsManifestBuilder.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrHlsManifestBuilder.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.util.Locale internal object SabrHlsManifestBuilder { diff --git a/src/main/kotlin/dev/typetype/server/services/SabrInFlightDemandTracker.kt b/src/main/kotlin/dev/typetype/server/services/SabrInFlightDemandTracker.kt index 97c9b780..e0f6ae20 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrInFlightDemandTracker.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrInFlightDemandTracker.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrSegmentRequest import java.util.concurrent.ConcurrentHashMap internal class SabrInFlightDemand( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrInfoFetcher.kt b/src/main/kotlin/dev/typetype/server/services/SabrInfoFetcher.kt index e71c0bb5..a1e9b15c 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrInfoFetcher.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrInfoFetcher.kt @@ -4,9 +4,9 @@ import dev.typetype.server.cache.CacheService import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import kotlinx.coroutines.withTimeoutOrNull -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrClientProfile +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo import org.slf4j.LoggerFactory internal class SabrInfoFetcher( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrInfoRepository.kt b/src/main/kotlin/dev/typetype/server/services/SabrInfoRepository.kt index 452aafe5..f0fbd251 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrInfoRepository.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrInfoRepository.kt @@ -1,8 +1,8 @@ package dev.typetype.server.services import dev.typetype.server.cache.CacheService -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo import java.time.Duration internal class SabrInfoRepository( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrInfoSharedCache.kt b/src/main/kotlin/dev/typetype/server/services/SabrInfoSharedCache.kt index 3be48f2a..eabccc84 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrInfoSharedCache.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrInfoSharedCache.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services import dev.typetype.server.cache.CacheService -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrInfo import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.io.ObjectInputStream diff --git a/src/main/kotlin/dev/typetype/server/services/SabrInitializationData.kt b/src/main/kotlin/dev/typetype/server/services/SabrInitializationData.kt index 95b1d8cc..0b9788ca 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrInitializationData.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrInitializationData.kt @@ -3,8 +3,8 @@ package dev.typetype.server.services import dev.typetype.server.cache.CacheService import kotlinx.coroutines.sync.withLock import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat import java.security.MessageDigest import java.time.Duration import java.util.Base64 diff --git a/src/main/kotlin/dev/typetype/server/services/SabrInitializationPolicy.kt b/src/main/kotlin/dev/typetype/server/services/SabrInitializationPolicy.kt index 2f1a6e58..6f85a8a0 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrInitializationPolicy.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrInitializationPolicy.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat internal object SabrInitializationPolicy { fun warmFormats( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrInitializationSegmentFetcher.kt b/src/main/kotlin/dev/typetype/server/services/SabrInitializationSegmentFetcher.kt index 337677b4..1ccab335 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrInitializationSegmentFetcher.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrInitializationSegmentFetcher.kt @@ -2,8 +2,8 @@ package dev.typetype.server.services import kotlinx.coroutines.sync.withLock import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest import org.slf4j.LoggerFactory internal suspend fun fetchSabrInitializationSegment( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrLiveContinuationRequest.kt b/src/main/kotlin/dev/typetype/server/services/SabrLiveContinuationRequest.kt index 2b690d87..d89e3736 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrLiveContinuationRequest.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrLiveContinuationRequest.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrBufferedRange -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrBufferedRange +import dev.typetype.server.sabr.YoutubeSabrFormat internal inline fun withLiveContinuationRequestShape( holder: SabrSessionHolder, diff --git a/src/main/kotlin/dev/typetype/server/services/SabrLivePlayback.kt b/src/main/kotlin/dev/typetype/server/services/SabrLivePlayback.kt index f01c902e..0507aa72 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrLivePlayback.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrLivePlayback.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat internal data class SabrLivePlaybackSnapshot( val active: Boolean, @@ -120,7 +120,7 @@ internal fun SabrSessionHolder.isHistoricalLiveRequest(request: SabrSegmentReque internal fun SabrSessionHolder.liveRetryAfterMs(blockedRequests: List = emptyList()): Long = DEFAULT_PLAYBACK_RETRY_MS -private fun org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState.observedEndMs( +private fun dev.typetype.server.sabr.YoutubeSabrStreamState.observedEndMs( format: YoutubeSabrFormat, ): Long { val sequence = runCatching { getMaxSegment(format) }.getOrDefault(0) diff --git a/src/main/kotlin/dev/typetype/server/services/SabrLivePlaybackDiscontinuity.kt b/src/main/kotlin/dev/typetype/server/services/SabrLivePlaybackDiscontinuity.kt index 61c3ad60..91ed693c 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrLivePlaybackDiscontinuity.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrLivePlaybackDiscontinuity.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat internal fun SabrSessionHolder.isLiveDemandOutsideRecoverableWindow(request: SabrSegmentRequest): Boolean { if (request.isInitializationSegment) return false diff --git a/src/main/kotlin/dev/typetype/server/services/SabrLivePumpStep.kt b/src/main/kotlin/dev/typetype/server/services/SabrLivePumpStep.kt index b9abf457..ac33f9f7 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrLivePumpStep.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrLivePumpStep.kt @@ -1,8 +1,8 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat internal suspend fun pumpLiveReadAhead( holder: SabrSessionHolder, diff --git a/src/main/kotlin/dev/typetype/server/services/SabrLiveWarmupRequest.kt b/src/main/kotlin/dev/typetype/server/services/SabrLiveWarmupRequest.kt index 8d0a7c81..189488ab 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrLiveWarmupRequest.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrLiveWarmupRequest.kt @@ -1,8 +1,8 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrBufferedRange -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrBufferedRange +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.YoutubeSabrFormat internal data class SabrLiveWarmupTarget( val sequence: Int, diff --git a/src/main/kotlin/dev/typetype/server/services/SabrManifestBuilder.kt b/src/main/kotlin/dev/typetype/server/services/SabrManifestBuilder.kt index 41043e13..33b45d76 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrManifestBuilder.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrManifestBuilder.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrStreamState internal object SabrManifestBuilder { fun build( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrManifestTiming.kt b/src/main/kotlin/dev/typetype/server/services/SabrManifestTiming.kt index 882a3bbc..433b3aec 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrManifestTiming.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrManifestTiming.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrStreamState internal object SabrManifestTiming { fun videoDurationSec( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrMimeAttributes.kt b/src/main/kotlin/dev/typetype/server/services/SabrMimeAttributes.kt index 50987ed4..4b99aaca 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrMimeAttributes.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrMimeAttributes.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat internal fun splitMime(mime: String): Pair { val parts = mime.split(";", limit = 2) diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPendingSeek.kt b/src/main/kotlin/dev/typetype/server/services/SabrPendingSeek.kt index 3cc1c668..43170eca 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPendingSeek.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPendingSeek.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrSegmentRequest internal fun SabrSessionHolder.consumeMatchingSeek(request: SabrSegmentRequest): Boolean { pendingRefetchRequest()?.takeIf { it.matches(request) }?.let { diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackCachedSegmentLocator.kt b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackCachedSegmentLocator.kt index 88fa4c0a..1eee1935 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackCachedSegmentLocator.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackCachedSegmentLocator.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat internal suspend fun SabrSessionStore.findCachedPlaybackMediaAt( holder: SabrSessionHolder, diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackDiagnostics.kt b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackDiagnostics.kt index 35064731..2c003d40 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackDiagnostics.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackDiagnostics.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest import java.util.concurrent.ConcurrentHashMap internal object SabrPlaybackDiagnostics { diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackManifestService.kt b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackManifestService.kt index 0695a916..c713e7a0 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackManifestService.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackManifestService.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat internal class SabrPlaybackManifestService { fun build(holder: SabrSessionHolder, mediaBasePath: String): SabrPlaybackManifestResult { diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackMediaFetcher.kt b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackMediaFetcher.kt index 4ba20e8e..bb1bd6c9 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackMediaFetcher.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackMediaFetcher.kt @@ -4,8 +4,8 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.runInterruptible import kotlinx.coroutines.withTimeoutOrNull -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest internal class SabrPlaybackMediaFetcher(private val sessionStore: SabrSessionStore) { suspend fun fetch( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSegmentResult.kt b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSegmentResult.kt index 62774b80..3f2cfc7c 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSegmentResult.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSegmentResult.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrMediaSegment internal sealed class SabrPlaybackSegmentResult { data class Ready(val mimeType: String, val bytes: ByteArray) : SabrPlaybackSegmentResult() diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSegmentSelection.kt b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSegmentSelection.kt index 2f957857..5fa0feb9 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSegmentSelection.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSegmentSelection.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat internal fun SabrSessionHolder.playbackStartSequence(format: YoutubeSabrFormat, playerTimeMs: Long): Int { liveSequenceAt(format, playerTimeMs)?.let { return it } diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSessionService.kt b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSessionService.kt index 6eb0d40d..b19fc4dd 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSessionService.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackSessionService.kt @@ -1,8 +1,8 @@ package dev.typetype.server.services import kotlinx.coroutines.withTimeoutOrNull -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat internal class SabrPlaybackSessionService(private val sessionStore: SabrSessionStore) { private val mediaFetcher = SabrPlaybackMediaFetcher(sessionStore) diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackStarter.kt b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackStarter.kt index bc587a5c..e2121ed0 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackStarter.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackStarter.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrSegmentRequest import org.slf4j.LoggerFactory internal object SabrPlaybackStarter { diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackWarmer.kt b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackWarmer.kt index 7c803ec0..45c37f49 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPlaybackWarmer.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPlaybackWarmer.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrMediaSegment import org.slf4j.LoggerFactory internal class SabrPlaybackWarmer { diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPlayerContextRecovery.kt b/src/main/kotlin/dev/typetype/server/services/SabrPlayerContextRecovery.kt index 76ddc7c6..f28cfbbc 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPlayerContextRecovery.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPlayerContextRecovery.kt @@ -2,9 +2,9 @@ package dev.typetype.server.services import kotlinx.coroutines.CancellationException import org.schabi.newpipe.extractor.exceptions.AntiBotException -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrProtocolException -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.SabrProtocolException +import dev.typetype.server.sabr.YoutubeSabrClientProfile +import dev.typetype.server.sabr.YoutubeSabrInfo internal class SabrPlayerContextRecovery( private val videoId: String, diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPlayerInfoProbe.kt b/src/main/kotlin/dev/typetype/server/services/SabrPlayerInfoProbe.kt index 44ecba53..c5ba312b 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPlayerInfoProbe.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPlayerInfoProbe.kt @@ -2,9 +2,9 @@ package dev.typetype.server.services import org.schabi.newpipe.extractor.localization.ContentCountry import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrProbe +import dev.typetype.server.sabr.YoutubeSabrClientProfile +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.SabrAdapter internal fun interface SabrPlayerInfoProbe { fun fetch( @@ -23,6 +23,6 @@ internal object PipePipeSabrPlayerInfoProbe : SabrPlayerInfoProbe { profile: YoutubeSabrClientProfile, token: SabrTokenBundle, ): YoutubeSabrInfo = TypetypeYoutubeSessionPoTokenProvider.withToken(token) { - YoutubeSabrProbe.fetchSabrInfo(videoId, profile, localization, contentCountry) + SabrAdapter.fetchSabrInfo(videoId, profile, localization, contentCountry) } } diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPreparedInfo.kt b/src/main/kotlin/dev/typetype/server/services/SabrPreparedInfo.kt index 23d59c87..d0d661e4 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPreparedInfo.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPreparedInfo.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrInfo internal class SabrPreparedInfo( val info: YoutubeSabrInfo, diff --git a/src/main/kotlin/dev/typetype/server/services/SabrPumpLogger.kt b/src/main/kotlin/dev/typetype/server/services/SabrPumpLogger.kt index d3230963..849a5068 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrPumpLogger.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrPumpLogger.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrSegmentRequest import org.slf4j.LoggerFactory internal object SabrPumpLogger { diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSegmentCache.kt b/src/main/kotlin/dev/typetype/server/services/SabrSegmentCache.kt index db315d9d..3e262d83 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSegmentCache.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSegmentCache.kt @@ -1,8 +1,8 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat internal class SabrSegmentCache { fun get(holder: SabrSessionHolder, request: SabrSegmentRequest): CachedSabrSegment? = diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSegmentDemandResolution.kt b/src/main/kotlin/dev/typetype/server/services/SabrSegmentDemandResolution.kt index 9acadfeb..8d8ee50b 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSegmentDemandResolution.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSegmentDemandResolution.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest internal fun SabrSessionHolder.resolveSegmentDemand( request: SabrSegmentRequest, diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSegmentDemandTracker.kt b/src/main/kotlin/dev/typetype/server/services/SabrSegmentDemandTracker.kt index cefd7153..f68e0adc 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSegmentDemandTracker.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSegmentDemandTracker.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrSegmentRequest import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.AtomicLong diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSessionFactory.kt b/src/main/kotlin/dev/typetype/server/services/SabrSessionFactory.kt index 5e6ac047..19dbecf3 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSessionFactory.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSessionFactory.kt @@ -1,8 +1,8 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession import java.time.Instant internal class SabrSessionFactory( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSessionHolder.kt b/src/main/kotlin/dev/typetype/server/services/SabrSessionHolder.kt index 626e6b2a..8bb0eb72 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSessionHolder.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSessionHolder.kt @@ -1,11 +1,11 @@ package dev.typetype.server.services import kotlinx.coroutines.sync.Mutex -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession import java.time.Instant import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.AtomicBoolean diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSessionIdentity.kt b/src/main/kotlin/dev/typetype/server/services/SabrSessionIdentity.kt index f1e86285..a11a99fd 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSessionIdentity.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSessionIdentity.kt @@ -2,8 +2,8 @@ package dev.typetype.server.services import okhttp3.HttpUrl.Companion.toHttpUrl import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper -import org.schabi.newpipe.extractor.services.youtube.sabr.TypeTypeYoutubeSabrInfoFactory -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.SabrAdapter +import dev.typetype.server.sabr.YoutubeSabrInfo internal object SabrSessionIdentity { fun fresh(info: YoutubeSabrInfo): YoutubeSabrInfo { @@ -14,7 +14,7 @@ internal object SabrSessionIdentity { .setQueryParameter("cpn", cpn) .build() .toString() - return TypeTypeYoutubeSabrInfoFactory.withPlaybackIdentity( + return SabrAdapter.withPlaybackIdentity( info, url, info.clientVersion, diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSessionMediaFetcher.kt b/src/main/kotlin/dev/typetype/server/services/SabrSessionMediaFetcher.kt index 605b5dc6..f0af4faf 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSessionMediaFetcher.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSessionMediaFetcher.kt @@ -1,8 +1,8 @@ package dev.typetype.server.services import kotlinx.coroutines.sync.withLock -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest import org.slf4j.LoggerFactory import java.time.Instant diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSessionPlayerContext.kt b/src/main/kotlin/dev/typetype/server/services/SabrSessionPlayerContext.kt index 2d0154d2..db7e1bf3 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSessionPlayerContext.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSessionPlayerContext.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrSession internal inline fun SabrSessionHolder.withPlayerContext(crossinline block: YoutubeSabrSession.() -> T): T { val token = playerContextToken ?: return session.block() diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSessionProgress.kt b/src/main/kotlin/dev/typetype/server/services/SabrSessionProgress.kt index cc2cd770..f68876c8 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSessionProgress.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSessionProgress.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.YoutubeSabrFormat internal fun SabrSessionHolder.markServed(segment: SabrMediaSegment): Unit { markServed(segment, activeGeneration()) diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSessionPump.kt b/src/main/kotlin/dev/typetype/server/services/SabrSessionPump.kt index 11280335..052e08d3 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSessionPump.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSessionPump.kt @@ -3,8 +3,8 @@ package dev.typetype.server.services import kotlinx.coroutines.delay import kotlinx.coroutines.sync.withLock import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest import java.time.Instant internal class SabrSessionPump( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSessionPumpLoop.kt b/src/main/kotlin/dev/typetype/server/services/SabrSessionPumpLoop.kt index 3a5fecd7..8f541214 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSessionPumpLoop.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSessionPumpLoop.kt @@ -7,10 +7,10 @@ import kotlinx.coroutines.runInterruptible import kotlinx.coroutines.sync.withLock import org.schabi.newpipe.extractor.exceptions.ExtractionException import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrRecoverableException -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrRecoverableException +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrSession import java.io.IOException internal class SabrSessionPumpLoop( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSessionStore.kt b/src/main/kotlin/dev/typetype/server/services/SabrSessionStore.kt index 57f705e3..56ae348a 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSessionStore.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSessionStore.kt @@ -9,10 +9,10 @@ import kotlinx.coroutines.cancel import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlinx.coroutines.sync.withLock -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo import java.time.Duration import java.time.Instant diff --git a/src/main/kotlin/dev/typetype/server/services/SabrSessionTimeRequests.kt b/src/main/kotlin/dev/typetype/server/services/SabrSessionTimeRequests.kt index 985d3015..3d4c0b1a 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrSessionTimeRequests.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrSessionTimeRequests.kt @@ -1,7 +1,7 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat internal fun SabrSessionHolder.mediaRequestsAt(playerTimeMs: Long): List = mediaRequestsAt(playerTimeMs, activeGeneration()) diff --git a/src/main/kotlin/dev/typetype/server/services/SabrTargetRequest.kt b/src/main/kotlin/dev/typetype/server/services/SabrTargetRequest.kt index 7b49e7a4..8465ed22 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrTargetRequest.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrTargetRequest.kt @@ -1,9 +1,9 @@ package dev.typetype.server.services import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrSession import org.slf4j.LoggerFactory internal fun YoutubeSabrSession.fetchTargetedSegment( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrTargetRequestShape.kt b/src/main/kotlin/dev/typetype/server/services/SabrTargetRequestShape.kt index 6c7bbb77..1fef82eb 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrTargetRequestShape.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrTargetRequestShape.kt @@ -1,9 +1,9 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrBufferedRange -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrBufferedRange +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrStreamState import org.slf4j.LoggerFactory internal inline fun withTargetedRequestShape( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrTokenBundle.kt b/src/main/kotlin/dev/typetype/server/services/SabrTokenBundle.kt index 001f71a0..f4fa83f9 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrTokenBundle.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrTokenBundle.kt @@ -2,7 +2,7 @@ package dev.typetype.server.services import org.json.JSONObject import org.schabi.newpipe.extractor.services.youtube.YoutubeSessionPoToken -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrInfo import java.util.Base64 internal class SabrTokenBundle( diff --git a/src/main/kotlin/dev/typetype/server/services/SabrUnauthorizedResponseRecovery.kt b/src/main/kotlin/dev/typetype/server/services/SabrUnauthorizedResponseRecovery.kt index 8f3d0d12..db9afa70 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrUnauthorizedResponseRecovery.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrUnauthorizedResponseRecovery.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrRecoverableException +import dev.typetype.server.sabr.SabrRecoverableException internal class SabrUnauthorizedResponseRecovery( private val refreshPoToken: (SabrSessionHolder) -> SabrTokenBundle?, diff --git a/src/main/kotlin/dev/typetype/server/services/SabrWindowSegmentFetcher.kt b/src/main/kotlin/dev/typetype/server/services/SabrWindowSegmentFetcher.kt index 9969c0f4..a6041877 100644 --- a/src/main/kotlin/dev/typetype/server/services/SabrWindowSegmentFetcher.kt +++ b/src/main/kotlin/dev/typetype/server/services/SabrWindowSegmentFetcher.kt @@ -1,8 +1,8 @@ package dev.typetype.server.services import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest import org.slf4j.LoggerFactory internal object SabrWindowSegmentFetcher { diff --git a/src/main/kotlin/dev/typetype/server/services/TokenYoutubeSession.kt b/src/main/kotlin/dev/typetype/server/services/TokenYoutubeSession.kt index 283479f6..713f16a2 100644 --- a/src/main/kotlin/dev/typetype/server/services/TokenYoutubeSession.kt +++ b/src/main/kotlin/dev/typetype/server/services/TokenYoutubeSession.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrInfo internal data class TokenYoutubeSession( val info: YoutubeSabrInfo, diff --git a/src/main/kotlin/dev/typetype/server/services/TypetypeTokenSabrPoTokenProvider.kt b/src/main/kotlin/dev/typetype/server/services/TypetypeTokenSabrPoTokenProvider.kt index 9495bcc1..ec844eb2 100644 --- a/src/main/kotlin/dev/typetype/server/services/TypetypeTokenSabrPoTokenProvider.kt +++ b/src/main/kotlin/dev/typetype/server/services/TypetypeTokenSabrPoTokenProvider.kt @@ -1,9 +1,9 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrPoTokenProvider -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrRecoverableException -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrPoTokenProvider +import dev.typetype.server.sabr.SabrRecoverableException +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrStreamState internal class TypetypeTokenSabrPoTokenProvider( private val tokenClient: TypetypeTokenSabrTokenClient, diff --git a/src/main/kotlin/dev/typetype/server/services/TypetypeTokenYoutubeSessionClient.kt b/src/main/kotlin/dev/typetype/server/services/TypetypeTokenYoutubeSessionClient.kt index 0629ee93..43074ff1 100644 --- a/src/main/kotlin/dev/typetype/server/services/TypetypeTokenYoutubeSessionClient.kt +++ b/src/main/kotlin/dev/typetype/server/services/TypetypeTokenYoutubeSessionClient.kt @@ -10,10 +10,9 @@ import okhttp3.Request import okhttp3.Response import org.json.JSONObject import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper -import org.schabi.newpipe.extractor.services.youtube.sabr.TypeTypeYoutubeSabrInfoFactory -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrProbe +import dev.typetype.server.sabr.SabrAdapter +import dev.typetype.server.sabr.YoutubeSabrClientProfile +import dev.typetype.server.sabr.YoutubeSabrInfo import java.io.IOException import java.net.URLEncoder import java.nio.charset.StandardCharsets @@ -107,7 +106,7 @@ internal class TypetypeTokenYoutubeSessionClient( ), ), ) - val info = YoutubeSabrProbe.fromPlayerResponse( + val info = SabrAdapter.fromPlayerResponse( videoId, YoutubeSabrClientProfile.MWEB, YoutubeParsingHelper.generateContentPlaybackNonce(), @@ -122,7 +121,7 @@ internal class TypetypeTokenYoutubeSessionClient( ?.queryParameter("cpn") ?.takeIf { it.isNotBlank() } if (playbackUrl != null && clientVersion != null) { - TypeTypeYoutubeSabrInfoFactory.withPlaybackIdentity( + SabrAdapter.withPlaybackIdentity( info, playbackUrl, clientVersion, From df345caaf4771d065f9b75d685ace87e07607467 Mon Sep 17 00:00:00 2001 From: Priveetee Date: Fri, 4 Sep 2026 11:44:05 +0200 Subject: [PATCH 07/12] test: migrate SABR fixtures to TypeType boundary --- .../server/SabrPlaybackGranularRoutesTest.kt | 10 +++++----- .../dev/typetype/server/SabrRoutesAccessTest.kt | 8 ++++---- .../server/SabrStreamContractFilterTest.kt | 5 ++--- .../YoutubeAuthenticatedExtractionProbeTest.kt | 2 +- .../server/routes/SabrLiveGapWindowTest.kt | 10 +++++----- .../routes/SabrLivePlaybackContinuityProbeTest.kt | 4 ++-- .../server/routes/SabrLivePlaybackOverlapTest.kt | 10 +++++----- .../routes/SabrLivePlaybackWindowBuilderTest.kt | 14 +++++++------- .../routes/SabrLiveRoundedBoundaryWindowTest.kt | 14 +++++++------- .../routes/SabrPlaybackAudioOnlyWindowTest.kt | 10 +++++----- .../server/routes/SabrPlaybackSeekRouteTest.kt | 8 ++++---- .../server/routes/SabrPlaybackWindowBuilderTest.kt | 14 +++++++------- .../routes/SabrProgressivePlaybackWindowTest.kt | 14 +++++++------- .../server/routes/SabrStreamContractFilterTest.kt | 4 ++-- .../services/AuthenticatedSabrInfoServiceTest.kt | 4 ++-- .../services/AuthenticatedSabrTimeoutTest.kt | 2 +- .../services/SabrAdaptiveInitializationTest.kt | 8 ++++---- .../services/SabrBootstrapStreamServiceTest.kt | 4 ++-- .../services/SabrCachedSegmentLocatorTest.kt | 10 +++++----- .../server/services/SabrDashManifestBuilderTest.kt | 4 ++-- .../server/services/SabrDemandFailurePumpTest.kt | 12 ++++++------ .../services/SabrDemandWatchdogBackoffTest.kt | 8 ++++---- .../services/SabrDemandWatchdogLifecycleTest.kt | 8 ++++---- .../server/services/SabrDownloadRangeTest.kt | 4 ++-- .../server/services/SabrDownloadStreamerTest.kt | 10 +++++----- .../services/SabrFallbackStreamServiceTest.kt | 4 ++-- .../services/SabrInitializationPolicyTest.kt | 2 +- .../services/SabrLiveContinuationRequestTest.kt | 14 +++++++------- .../server/services/SabrLiveFutureRequestTest.kt | 14 +++++++------- .../services/SabrLivePlaybackSessionServiceTest.kt | 12 ++++++------ .../server/services/SabrLivePlaybackTest.kt | 14 +++++++------- .../server/services/SabrLiveProtocolProbeTest.kt | 2 +- .../server/services/SabrLivePumpStepTest.kt | 10 +++++----- .../server/services/SabrLiveSessionWarmupTest.kt | 14 +++++++------- .../services/SabrMissingDemandRecoveryTest.kt | 10 +++++----- .../SabrPlaybackCachedSegmentLocatorTest.kt | 8 ++++---- .../server/services/SabrPlaybackDiagnosticsTest.kt | 4 ++-- .../SabrPlaybackInitializationFailureTest.kt | 8 ++++---- .../services/SabrPlaybackLiveGapServiceTest.kt | 10 +++++----- .../services/SabrPlaybackManifestServiceTest.kt | 8 ++++---- .../services/SabrPlaybackSessionServiceTest.kt | 10 +++++----- .../services/SabrPlayerContextRecoveryTest.kt | 6 +++--- .../server/services/SabrPreparedInfoCacheTest.kt | 8 ++++---- .../server/services/SabrProbeDiagnostics.kt | 6 +++--- .../dev/typetype/server/services/SabrProbeFetch.kt | 4 ++-- .../server/services/SabrProbeFetchResult.kt | 2 +- .../dev/typetype/server/services/SabrProbeTest.kt | 8 ++++---- .../server/services/SabrPumpLauncherTest.kt | 8 ++++---- .../server/services/SabrPumpRuntimeTest.kt | 6 +++--- .../server/services/SabrRandomAccessProbeTest.kt | 6 +++--- .../services/SabrRecoverablePumpFailureTest.kt | 10 +++++----- .../server/services/SabrSeekRepositionPumpTest.kt | 14 +++++++------- .../server/services/SabrSegmentCacheTest.kt | 14 +++++++------- .../services/SabrSegmentDemandResolutionTest.kt | 14 +++++++------- .../services/SabrSegmentDemandTrackerTest.kt | 8 ++++---- .../services/SabrSessionPlayerContextTest.kt | 8 ++++---- .../server/services/SabrSessionPumpLoopTest.kt | 14 +++++++------- .../server/services/SabrSessionPumpTest.kt | 14 +++++++------- .../server/services/SabrSessionRegistryTest.kt | 8 ++++---- .../server/services/SabrSessionStoreTest.kt | 6 +++--- .../server/services/SabrSessionTimeRequestsTest.kt | 14 +++++++------- .../services/SabrTransientDemandFailureTest.kt | 14 +++++++------- .../services/SabrTransitioningLivePlaybackTest.kt | 8 ++++---- .../SabrUnauthorizedResponseRecoveryTest.kt | 8 ++++---- .../services/TypetypeTokenSabrTokenClientTest.kt | 6 +++--- 65 files changed, 279 insertions(+), 280 deletions(-) diff --git a/src/test/kotlin/dev/typetype/server/SabrPlaybackGranularRoutesTest.kt b/src/test/kotlin/dev/typetype/server/SabrPlaybackGranularRoutesTest.kt index 75475493..29e31f97 100644 --- a/src/test/kotlin/dev/typetype/server/SabrPlaybackGranularRoutesTest.kt +++ b/src/test/kotlin/dev/typetype/server/SabrPlaybackGranularRoutesTest.kt @@ -29,11 +29,11 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrPlaybackGranularRoutesTest { diff --git a/src/test/kotlin/dev/typetype/server/SabrRoutesAccessTest.kt b/src/test/kotlin/dev/typetype/server/SabrRoutesAccessTest.kt index 14c572c7..07c08496 100644 --- a/src/test/kotlin/dev/typetype/server/SabrRoutesAccessTest.kt +++ b/src/test/kotlin/dev/typetype/server/SabrRoutesAccessTest.kt @@ -24,10 +24,10 @@ import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrRoutesAccessTest { diff --git a/src/test/kotlin/dev/typetype/server/SabrStreamContractFilterTest.kt b/src/test/kotlin/dev/typetype/server/SabrStreamContractFilterTest.kt index 1a502840..f2cf7db4 100644 --- a/src/test/kotlin/dev/typetype/server/SabrStreamContractFilterTest.kt +++ b/src/test/kotlin/dev/typetype/server/SabrStreamContractFilterTest.kt @@ -10,8 +10,8 @@ import io.mockk.mockk import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo class SabrStreamContractFilterTest { @Test @@ -109,7 +109,6 @@ class SabrStreamContractFilterTest { private fun sabrFormat(itag: Int, isAudio: Boolean, mimeType: String): YoutubeSabrFormat { val format = mockk() every { format.itag } returns itag - every { format.getItag() } returns itag every { format.isAudio } returns isAudio every { format.isVideo } returns !isAudio every { format.mimeType } returns mimeType diff --git a/src/test/kotlin/dev/typetype/server/YoutubeAuthenticatedExtractionProbeTest.kt b/src/test/kotlin/dev/typetype/server/YoutubeAuthenticatedExtractionProbeTest.kt index e74fd18f..f68d0bd7 100644 --- a/src/test/kotlin/dev/typetype/server/YoutubeAuthenticatedExtractionProbeTest.kt +++ b/src/test/kotlin/dev/typetype/server/YoutubeAuthenticatedExtractionProbeTest.kt @@ -27,7 +27,7 @@ import org.schabi.newpipe.extractor.NewPipe import org.schabi.newpipe.extractor.ServiceList import org.schabi.newpipe.extractor.localization.ContentCountry import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrSession import java.nio.file.Files import java.nio.file.Path diff --git a/src/test/kotlin/dev/typetype/server/routes/SabrLiveGapWindowTest.kt b/src/test/kotlin/dev/typetype/server/routes/SabrLiveGapWindowTest.kt index 9a7f39de..00e21bb7 100644 --- a/src/test/kotlin/dev/typetype/server/routes/SabrLiveGapWindowTest.kt +++ b/src/test/kotlin/dev/typetype/server/routes/SabrLiveGapWindowTest.kt @@ -13,11 +13,11 @@ import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrLiveGapWindowTest { diff --git a/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackContinuityProbeTest.kt b/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackContinuityProbeTest.kt index 3c0fe962..fd4539d2 100644 --- a/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackContinuityProbeTest.kt +++ b/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackContinuityProbeTest.kt @@ -19,8 +19,8 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import org.junit.jupiter.api.condition.EnabledIfSystemProperty -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat @EnabledIfSystemProperty(named = "sabr.probe", matches = "true") @Tag("network") diff --git a/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackOverlapTest.kt b/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackOverlapTest.kt index 4f5dff49..5d9d1d6b 100644 --- a/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackOverlapTest.kt +++ b/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackOverlapTest.kt @@ -11,11 +11,11 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrLivePlaybackOverlapTest { diff --git a/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackWindowBuilderTest.kt b/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackWindowBuilderTest.kt index bfaa8b02..21613725 100644 --- a/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackWindowBuilderTest.kt +++ b/src/test/kotlin/dev/typetype/server/routes/SabrLivePlaybackWindowBuilderTest.kt @@ -12,13 +12,13 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrLivePlaybackWindowBuilderTest { diff --git a/src/test/kotlin/dev/typetype/server/routes/SabrLiveRoundedBoundaryWindowTest.kt b/src/test/kotlin/dev/typetype/server/routes/SabrLiveRoundedBoundaryWindowTest.kt index 3c488ebc..382d1997 100644 --- a/src/test/kotlin/dev/typetype/server/routes/SabrLiveRoundedBoundaryWindowTest.kt +++ b/src/test/kotlin/dev/typetype/server/routes/SabrLiveRoundedBoundaryWindowTest.kt @@ -11,13 +11,13 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrLiveRoundedBoundaryWindowTest { diff --git a/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackAudioOnlyWindowTest.kt b/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackAudioOnlyWindowTest.kt index 40599f0a..1ea1de7c 100644 --- a/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackAudioOnlyWindowTest.kt +++ b/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackAudioOnlyWindowTest.kt @@ -14,11 +14,11 @@ import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrPlaybackAudioOnlyWindowTest { diff --git a/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackSeekRouteTest.kt b/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackSeekRouteTest.kt index 11c5f0ef..9a1dc484 100644 --- a/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackSeekRouteTest.kt +++ b/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackSeekRouteTest.kt @@ -25,10 +25,10 @@ import io.mockk.mockk import io.mockk.verify import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrPlaybackSeekRouteTest { diff --git a/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackWindowBuilderTest.kt b/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackWindowBuilderTest.kt index 17aeaeac..19ddf9d7 100644 --- a/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackWindowBuilderTest.kt +++ b/src/test/kotlin/dev/typetype/server/routes/SabrPlaybackWindowBuilderTest.kt @@ -13,13 +13,13 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrPlaybackWindowBuilderTest { diff --git a/src/test/kotlin/dev/typetype/server/routes/SabrProgressivePlaybackWindowTest.kt b/src/test/kotlin/dev/typetype/server/routes/SabrProgressivePlaybackWindowTest.kt index 6cc81ad7..43989f9d 100644 --- a/src/test/kotlin/dev/typetype/server/routes/SabrProgressivePlaybackWindowTest.kt +++ b/src/test/kotlin/dev/typetype/server/routes/SabrProgressivePlaybackWindowTest.kt @@ -11,13 +11,13 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrProgressivePlaybackWindowTest { diff --git a/src/test/kotlin/dev/typetype/server/routes/SabrStreamContractFilterTest.kt b/src/test/kotlin/dev/typetype/server/routes/SabrStreamContractFilterTest.kt index f0078556..5672234b 100644 --- a/src/test/kotlin/dev/typetype/server/routes/SabrStreamContractFilterTest.kt +++ b/src/test/kotlin/dev/typetype/server/routes/SabrStreamContractFilterTest.kt @@ -12,8 +12,8 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo class SabrStreamContractFilterTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/AuthenticatedSabrInfoServiceTest.kt b/src/test/kotlin/dev/typetype/server/services/AuthenticatedSabrInfoServiceTest.kt index ffdb5440..51448075 100644 --- a/src/test/kotlin/dev/typetype/server/services/AuthenticatedSabrInfoServiceTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/AuthenticatedSabrInfoServiceTest.kt @@ -12,8 +12,8 @@ import org.junit.jupiter.api.Assertions.assertSame import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test import org.schabi.newpipe.extractor.services.youtube.YoutubeSessionPoToken -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo class AuthenticatedSabrInfoServiceTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/AuthenticatedSabrTimeoutTest.kt b/src/test/kotlin/dev/typetype/server/services/AuthenticatedSabrTimeoutTest.kt index 549950a8..32501d89 100644 --- a/src/test/kotlin/dev/typetype/server/services/AuthenticatedSabrTimeoutTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/AuthenticatedSabrTimeoutTest.kt @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.schabi.newpipe.extractor.services.youtube.YoutubeSessionPoToken -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrInfo class AuthenticatedSabrTimeoutTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/SabrAdaptiveInitializationTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrAdaptiveInitializationTest.kt index 6c2f8a78..a1e9fde4 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrAdaptiveInitializationTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrAdaptiveInitializationTest.kt @@ -8,10 +8,10 @@ import org.junit.jupiter.api.Assertions.assertArrayEquals import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState class SabrAdaptiveInitializationTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/SabrBootstrapStreamServiceTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrBootstrapStreamServiceTest.kt index 9be05aad..feea11e9 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrBootstrapStreamServiceTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrBootstrapStreamServiceTest.kt @@ -8,8 +8,8 @@ import io.mockk.mockk import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo class SabrBootstrapStreamServiceTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/SabrCachedSegmentLocatorTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrCachedSegmentLocatorTest.kt index 4cf003ee..a111f8bd 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrCachedSegmentLocatorTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrCachedSegmentLocatorTest.kt @@ -5,11 +5,11 @@ import io.mockk.mockk import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertSame import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrSession class SabrCachedSegmentLocatorTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/SabrDashManifestBuilderTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrDashManifestBuilderTest.kt index 12e7aae0..30f0946e 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrDashManifestBuilderTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrDashManifestBuilderTest.kt @@ -5,8 +5,8 @@ import io.mockk.mockk import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrStreamState class SabrDashManifestBuilderTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/SabrDemandFailurePumpTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrDemandFailurePumpTest.kt index 1496c267..880dcb81 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrDemandFailurePumpTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrDemandFailurePumpTest.kt @@ -16,12 +16,12 @@ import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicInteger diff --git a/src/test/kotlin/dev/typetype/server/services/SabrDemandWatchdogBackoffTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrDemandWatchdogBackoffTest.kt index facd8627..0541b1e8 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrDemandWatchdogBackoffTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrDemandWatchdogBackoffTest.kt @@ -11,10 +11,10 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession import java.time.Instant @OptIn(ExperimentalCoroutinesApi::class) diff --git a/src/test/kotlin/dev/typetype/server/services/SabrDemandWatchdogLifecycleTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrDemandWatchdogLifecycleTest.kt index a0be4993..4d183d57 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrDemandWatchdogLifecycleTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrDemandWatchdogLifecycleTest.kt @@ -11,10 +11,10 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession import java.time.Instant @OptIn(ExperimentalCoroutinesApi::class) diff --git a/src/test/kotlin/dev/typetype/server/services/SabrDownloadRangeTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrDownloadRangeTest.kt index 3cea29a5..8dc915fd 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrDownloadRangeTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrDownloadRangeTest.kt @@ -6,8 +6,8 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrStreamState class SabrDownloadRangeTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/SabrDownloadStreamerTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrDownloadStreamerTest.kt index c6c9225c..0602c2a3 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrDownloadStreamerTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrDownloadStreamerTest.kt @@ -8,11 +8,11 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Test import org.junit.jupiter.api.Assertions.assertArrayEquals import org.junit.jupiter.api.Assertions.assertEquals -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.io.IOException diff --git a/src/test/kotlin/dev/typetype/server/services/SabrFallbackStreamServiceTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrFallbackStreamServiceTest.kt index 2f556726..c5c0c8f0 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrFallbackStreamServiceTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrFallbackStreamServiceTest.kt @@ -10,8 +10,8 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo class SabrFallbackStreamServiceTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/SabrInitializationPolicyTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrInitializationPolicyTest.kt index 1619f081..2ce89bfa 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrInitializationPolicyTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrInitializationPolicyTest.kt @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat class SabrInitializationPolicyTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/SabrLiveContinuationRequestTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrLiveContinuationRequestTest.kt index aa9c30c9..4d94d890 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrLiveContinuationRequestTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrLiveContinuationRequestTest.kt @@ -6,13 +6,13 @@ import io.mockk.verify import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrBufferedRange -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrBufferedRange +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrLiveContinuationRequestTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrLiveFutureRequestTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrLiveFutureRequestTest.kt index 9151234e..9d9d5711 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrLiveFutureRequestTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrLiveFutureRequestTest.kt @@ -5,13 +5,13 @@ import io.mockk.mockk import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrLiveFutureRequestTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrLivePlaybackSessionServiceTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrLivePlaybackSessionServiceTest.kt index 9b5a88a4..e1b3d56c 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrLivePlaybackSessionServiceTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrLivePlaybackSessionServiceTest.kt @@ -12,12 +12,12 @@ import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertSame import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant import java.util.concurrent.atomic.AtomicInteger diff --git a/src/test/kotlin/dev/typetype/server/services/SabrLivePlaybackTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrLivePlaybackTest.kt index 537cc23e..94fe8c6a 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrLivePlaybackTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrLivePlaybackTest.kt @@ -8,13 +8,13 @@ import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrLivePlaybackTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrLiveProtocolProbeTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrLiveProtocolProbeTest.kt index df511f17..c4877083 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrLiveProtocolProbeTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrLiveProtocolProbeTest.kt @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import org.junit.jupiter.api.condition.EnabledIfSystemProperty -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrFormat import java.security.MessageDigest @EnabledIfSystemProperty(named = "sabr.probe", matches = "true") diff --git a/src/test/kotlin/dev/typetype/server/services/SabrLivePumpStepTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrLivePumpStepTest.kt index a7d09976..70915d31 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrLivePumpStepTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrLivePumpStepTest.kt @@ -6,11 +6,11 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession import java.time.Instant class SabrLivePumpStepTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrLiveSessionWarmupTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrLiveSessionWarmupTest.kt index 30e2aa12..53ae9e5b 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrLiveSessionWarmupTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrLiveSessionWarmupTest.kt @@ -7,13 +7,13 @@ import org.junit.jupiter.api.Assertions.assertArrayEquals import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrBufferedRange -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrBufferedRange +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrLiveSessionWarmupTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrMissingDemandRecoveryTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrMissingDemandRecoveryTest.kt index d4a69be9..84a84099 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrMissingDemandRecoveryTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrMissingDemandRecoveryTest.kt @@ -7,11 +7,11 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant @OptIn(ExperimentalCoroutinesApi::class) diff --git a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackCachedSegmentLocatorTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackCachedSegmentLocatorTest.kt index 737d4560..5abc77c0 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackCachedSegmentLocatorTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackCachedSegmentLocatorTest.kt @@ -6,10 +6,10 @@ import io.mockk.mockk import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState class SabrPlaybackCachedSegmentLocatorTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackDiagnosticsTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackDiagnosticsTest.kt index 2bd5dad6..ecf413a9 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackDiagnosticsTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackDiagnosticsTest.kt @@ -4,8 +4,8 @@ import io.mockk.every import io.mockk.mockk import io.mockk.verify import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat class SabrPlaybackDiagnosticsTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackInitializationFailureTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackInitializationFailureTest.kt index 59b34411..d59079db 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackInitializationFailureTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackInitializationFailureTest.kt @@ -13,10 +13,10 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant @OptIn(ExperimentalCoroutinesApi::class) diff --git a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackLiveGapServiceTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackLiveGapServiceTest.kt index 36495ca9..1d65b21e 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackLiveGapServiceTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackLiveGapServiceTest.kt @@ -8,11 +8,11 @@ import org.junit.jupiter.api.Assertions.assertArrayEquals import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant import java.util.Base64 diff --git a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackManifestServiceTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackManifestServiceTest.kt index e1e11413..c6dd80f3 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackManifestServiceTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackManifestServiceTest.kt @@ -5,10 +5,10 @@ import io.mockk.mockk import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrPlaybackManifestServiceTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackSessionServiceTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackSessionServiceTest.kt index 420f27b0..83e37887 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackSessionServiceTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackSessionServiceTest.kt @@ -12,11 +12,11 @@ import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertSame import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant import java.util.Base64 import java.util.concurrent.atomic.AtomicInteger diff --git a/src/test/kotlin/dev/typetype/server/services/SabrPlayerContextRecoveryTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrPlayerContextRecoveryTest.kt index e1f25a8f..8961c0d6 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrPlayerContextRecoveryTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrPlayerContextRecoveryTest.kt @@ -11,9 +11,9 @@ import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test import org.schabi.newpipe.extractor.exceptions.AntiBotException -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrProtocolException -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.SabrProtocolException +import dev.typetype.server.sabr.YoutubeSabrClientProfile +import dev.typetype.server.sabr.YoutubeSabrInfo import java.io.IOException class SabrPlayerContextRecoveryTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrPreparedInfoCacheTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrPreparedInfoCacheTest.kt index bdad3b61..2ce9c2a1 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrPreparedInfoCacheTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrPreparedInfoCacheTest.kt @@ -11,9 +11,9 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertSame import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrClientProfile +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo import java.time.Duration class SabrPreparedInfoCacheTest { @@ -157,7 +157,7 @@ class SabrPreparedInfoCacheTest { every { tokenClient.fetch("video", forceRefresh = true, refreshVideo = false) } returns refreshed val probe = SabrPlayerInfoProbe { _, profile, token -> if (token === initial) { - throw org.schabi.newpipe.extractor.services.youtube.sabr.SabrProtocolException( + throw dev.typetype.server.sabr.SabrProtocolException( "Player response has no streamingData for $profile", ) } diff --git a/src/test/kotlin/dev/typetype/server/services/SabrProbeDiagnostics.kt b/src/test/kotlin/dev/typetype/server/services/SabrProbeDiagnostics.kt index 4caf767c..7c28b7f1 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrProbeDiagnostics.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrProbeDiagnostics.kt @@ -1,8 +1,8 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat internal fun printSabrProbeFormat(label: String, format: YoutubeSabrFormat): Unit { println( diff --git a/src/test/kotlin/dev/typetype/server/services/SabrProbeFetch.kt b/src/test/kotlin/dev/typetype/server/services/SabrProbeFetch.kt index be85dc51..86f2cf76 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrProbeFetch.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrProbeFetch.kt @@ -2,8 +2,8 @@ package dev.typetype.server.services import kotlinx.coroutines.CancellationException import kotlinx.coroutines.withTimeoutOrNull -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest internal suspend fun fetchSabrProbeSegment( store: SabrSessionStore, diff --git a/src/test/kotlin/dev/typetype/server/services/SabrProbeFetchResult.kt b/src/test/kotlin/dev/typetype/server/services/SabrProbeFetchResult.kt index 15dccb28..55d799d9 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrProbeFetchResult.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrProbeFetchResult.kt @@ -1,6 +1,6 @@ package dev.typetype.server.services -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrMediaSegment internal data class SabrProbeFetchResult( val segment: SabrMediaSegment?, diff --git a/src/test/kotlin/dev/typetype/server/services/SabrProbeTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrProbeTest.kt index e7dc7e05..9b764213 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrProbeTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrProbeTest.kt @@ -5,9 +5,9 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.condition.EnabledIfSystemProperty import org.schabi.newpipe.extractor.localization.ContentCountry import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrProbe -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrClientProfile +import dev.typetype.server.sabr.SabrAdapter +import dev.typetype.server.sabr.YoutubeSabrSession @EnabledIfSystemProperty(named = "sabr.probe", matches = "true") @Tag("network") @@ -39,7 +39,7 @@ class SabrProbeTest { try { val token = tokenClient.fetch(videoId) ?: error("No SABR token") val info = TypetypeYoutubeSessionPoTokenProvider.withToken(token) { - YoutubeSabrProbe.fetchSabrInfo(videoId, profile, loc, country) + SabrAdapter.fetchSabrInfo(videoId, profile, loc, country) } println("serverAbrStreamingUrl present: ${!info.serverAbrStreamingUrl.isNullOrEmpty()}") println("videoPlaybackUstreamerConfig present: ${!info.videoPlaybackUstreamerConfig.isNullOrEmpty()}") diff --git a/src/test/kotlin/dev/typetype/server/services/SabrPumpLauncherTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrPumpLauncherTest.kt index a4b8a889..9f021795 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrPumpLauncherTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrPumpLauncherTest.kt @@ -15,10 +15,10 @@ import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession import java.time.Instant @OptIn(ExperimentalCoroutinesApi::class) diff --git a/src/test/kotlin/dev/typetype/server/services/SabrPumpRuntimeTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrPumpRuntimeTest.kt index ef44710a..162d2c52 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrPumpRuntimeTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrPumpRuntimeTest.kt @@ -6,9 +6,9 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrNextRequestPolicy -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrNextRequestPolicy +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState class SabrPumpRuntimeTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/SabrRandomAccessProbeTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrRandomAccessProbeTest.kt index 8cfd0190..3b058d58 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrRandomAccessProbeTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrRandomAccessProbeTest.kt @@ -8,9 +8,9 @@ import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import org.junit.jupiter.api.condition.EnabledIfSystemProperty import org.schabi.newpipe.extractor.NewPipe -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo import org.schabi.newpipe.extractor.stream.StreamInfo @EnabledIfSystemProperty(named = "sabr.probe", matches = "true") diff --git a/src/test/kotlin/dev/typetype/server/services/SabrRecoverablePumpFailureTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrRecoverablePumpFailureTest.kt index 9f76af83..a477f8dc 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrRecoverablePumpFailureTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrRecoverablePumpFailureTest.kt @@ -7,11 +7,11 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrRecoverableException -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrRecoverableException +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant @OptIn(ExperimentalCoroutinesApi::class) diff --git a/src/test/kotlin/dev/typetype/server/services/SabrSeekRepositionPumpTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrSeekRepositionPumpTest.kt index 25c24a4c..6ddab8af 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrSeekRepositionPumpTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrSeekRepositionPumpTest.kt @@ -8,13 +8,13 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrSeekRepositionPumpTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrSegmentCacheTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrSegmentCacheTest.kt index 4552ef57..d718d8df 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrSegmentCacheTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrSegmentCacheTest.kt @@ -7,13 +7,13 @@ import org.junit.jupiter.api.Assertions.assertArrayEquals import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrSegmentCacheTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrSegmentDemandResolutionTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrSegmentDemandResolutionTest.kt index a8768057..0eb98055 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrSegmentDemandResolutionTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrSegmentDemandResolutionTest.kt @@ -9,13 +9,13 @@ import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertSame import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrSegmentDemandResolutionTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrSegmentDemandTrackerTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrSegmentDemandTrackerTest.kt index d9a1194d..688eea20 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrSegmentDemandTrackerTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrSegmentDemandTrackerTest.kt @@ -6,10 +6,10 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession import java.time.Instant class SabrSegmentDemandTrackerTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrSessionPlayerContextTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrSessionPlayerContextTest.kt index b95c4f07..20050799 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrSessionPlayerContextTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrSessionPlayerContextTest.kt @@ -7,10 +7,10 @@ import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test import org.schabi.newpipe.extractor.localization.ContentCountry import org.schabi.newpipe.extractor.localization.Localization -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrSessionPlayerContextTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrSessionPumpLoopTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrSessionPumpLoopTest.kt index f8d8a24d..d6e708ec 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrSessionPumpLoopTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrSessionPumpLoopTest.kt @@ -8,13 +8,13 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant @OptIn(ExperimentalCoroutinesApi::class) diff --git a/src/test/kotlin/dev/typetype/server/services/SabrSessionPumpTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrSessionPumpTest.kt index b1b93b14..e1209e0f 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrSessionPumpTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrSessionPumpTest.kt @@ -9,13 +9,13 @@ import org.junit.jupiter.api.Test import io.mockk.every import io.mockk.mockk import io.mockk.verify -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrSessionPumpTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrSessionRegistryTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrSessionRegistryTest.kt index 16c88046..7bc34a9b 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrSessionRegistryTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrSessionRegistryTest.kt @@ -7,10 +7,10 @@ import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertSame import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant import java.util.concurrent.CountDownLatch diff --git a/src/test/kotlin/dev/typetype/server/services/SabrSessionStoreTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrSessionStoreTest.kt index 8ffdeb77..85254a98 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrSessionStoreTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrSessionStoreTest.kt @@ -4,7 +4,7 @@ import kotlinx.coroutines.runBlocking import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import org.junit.jupiter.api.condition.EnabledIfSystemProperty -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.SabrSegmentRequest @EnabledIfSystemProperty(named = "sabr.probe", matches = "true") @Tag("network") @@ -63,8 +63,8 @@ class SabrSessionStoreTest { private fun mediaRequestsForProbe( holder: SabrSessionHolder, - video: org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat, - audio: org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat, + video: dev.typetype.server.sabr.YoutubeSabrFormat, + audio: dev.typetype.server.sabr.YoutubeSabrFormat, playerTimeMs: Long, ): List { val videoSequence = System.getenv("SABR_PROBE_VIDEO_SEQUENCE")?.toIntOrNull() diff --git a/src/test/kotlin/dev/typetype/server/services/SabrSessionTimeRequestsTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrSessionTimeRequestsTest.kt index d62d6ec2..55509e38 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrSessionTimeRequestsTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrSessionTimeRequestsTest.kt @@ -4,13 +4,13 @@ import io.mockk.every import io.mockk.mockk import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrSessionTimeRequestsTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrTransientDemandFailureTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrTransientDemandFailureTest.kt index b9613340..cce09dc0 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrTransientDemandFailureTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrTransientDemandFailureTest.kt @@ -8,13 +8,13 @@ import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaHeader -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrMediaSegment -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrSegmentRequest -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrMediaHeader +import dev.typetype.server.sabr.SabrMediaSegment +import dev.typetype.server.sabr.SabrSegmentRequest +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.io.IOException import java.time.Instant diff --git a/src/test/kotlin/dev/typetype/server/services/SabrTransitioningLivePlaybackTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrTransitioningLivePlaybackTest.kt index 0cdbfa61..d7e90ce1 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrTransitioningLivePlaybackTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrTransitioningLivePlaybackTest.kt @@ -10,10 +10,10 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState import java.time.Instant class SabrTransitioningLivePlaybackTest { diff --git a/src/test/kotlin/dev/typetype/server/services/SabrUnauthorizedResponseRecoveryTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrUnauthorizedResponseRecoveryTest.kt index e398e8b6..a4aef148 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrUnauthorizedResponseRecoveryTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrUnauthorizedResponseRecoveryTest.kt @@ -5,10 +5,10 @@ import io.mockk.mockk import io.mockk.verify import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrRecoverableException -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrSession -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrRecoverableException +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrSession +import dev.typetype.server.sabr.YoutubeSabrStreamState class SabrUnauthorizedResponseRecoveryTest { @Test diff --git a/src/test/kotlin/dev/typetype/server/services/TypetypeTokenSabrTokenClientTest.kt b/src/test/kotlin/dev/typetype/server/services/TypetypeTokenSabrTokenClientTest.kt index 6022321e..dda9d1b6 100644 --- a/src/test/kotlin/dev/typetype/server/services/TypetypeTokenSabrTokenClientTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/TypetypeTokenSabrTokenClientTest.kt @@ -15,9 +15,9 @@ import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.SabrRecoverableException -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrStreamState +import dev.typetype.server.sabr.SabrRecoverableException +import dev.typetype.server.sabr.YoutubeSabrInfo +import dev.typetype.server.sabr.YoutubeSabrStreamState class TypetypeTokenSabrTokenClientTest { From 915991cde7e406e1e7217cc6cdd98b22000f8d3f Mon Sep 17 00:00:00 2001 From: Priveetee Date: Fri, 4 Sep 2026 11:44:09 +0200 Subject: [PATCH 08/12] test: cover Pipe boundary doubles in SABR isolation --- .../SabrPlaybackSessionIsolationTest.kt | 24 ++++++++++++++--- .../services/SabrSessionIdentityTest.kt | 26 +++++++++++++++---- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackSessionIsolationTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackSessionIsolationTest.kt index e36b8f97..1e6223c6 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrPlaybackSessionIsolationTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrPlaybackSessionIsolationTest.kt @@ -6,9 +6,12 @@ import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Assertions.assertNotSame import org.junit.jupiter.api.Assertions.assertSame import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile as PipeProfile +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat as PipeFormat +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo as PipeInfo +import dev.typetype.server.sabr.YoutubeSabrClientProfile +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo class SabrPlaybackSessionIsolationTest { @Test @@ -61,6 +64,16 @@ class SabrPlaybackSessionIsolationTest { every { info.serverAbrStreamingUrl } returns "https://example.com/sabr" every { info.videoPlaybackUstreamerConfig } returns "config" every { info.formats } returns emptyList() + val pipeInfo = mockk(relaxed = true) + every { info.delegate } returns pipeInfo + every { pipeInfo.profile } returns PipeProfile.WEB + every { pipeInfo.videoId } returns "video" + every { pipeInfo.cpn } returns "source-cpn" + every { pipeInfo.clientVersion } returns "1.2.3" + every { pipeInfo.visitorData } returns "visitor" + every { pipeInfo.serverAbrStreamingUrl } returns "https://example.com/sabr" + every { pipeInfo.videoPlaybackUstreamerConfig } returns "config" + every { pipeInfo.formats } returns emptyList() return info } @@ -70,6 +83,11 @@ class SabrPlaybackSessionIsolationTest { every { format.isAudio } returns isAudio every { format.isVideo } returns !isAudio every { format.audioTrackId } returns null + val pipeFormat = mockk(relaxed = true) + every { format.delegate } returns pipeFormat + every { pipeFormat.itag } returns itag + every { pipeFormat.isAudio } returns isAudio + every { pipeFormat.isVideo } returns !isAudio return format } diff --git a/src/test/kotlin/dev/typetype/server/services/SabrSessionIdentityTest.kt b/src/test/kotlin/dev/typetype/server/services/SabrSessionIdentityTest.kt index 1545d8a8..1d743c74 100644 --- a/src/test/kotlin/dev/typetype/server/services/SabrSessionIdentityTest.kt +++ b/src/test/kotlin/dev/typetype/server/services/SabrSessionIdentityTest.kt @@ -5,17 +5,20 @@ import io.mockk.mockk import okhttp3.HttpUrl.Companion.toHttpUrl import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals -import org.junit.jupiter.api.Assertions.assertSame import org.junit.jupiter.api.Test -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat -import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrClientProfile as PipeProfile +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat as PipeFormat +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrInfo as PipeInfo +import dev.typetype.server.sabr.YoutubeSabrClientProfile +import dev.typetype.server.sabr.YoutubeSabrFormat +import dev.typetype.server.sabr.YoutubeSabrInfo class SabrSessionIdentityTest { @Test fun `fresh identities use unique coherent playback nonces`() { val formats = listOf(mockk()) val source = mockk() + every { formats[0].itag } returns 140 every { source.profile } returns YoutubeSabrClientProfile.WEB every { source.videoId } returns "video" every { source.clientVersion } returns "1.2.3" @@ -23,6 +26,19 @@ class SabrSessionIdentityTest { every { source.serverAbrStreamingUrl } returns "https://example.com/sabr?cpn=stale&foo=bar" every { source.videoPlaybackUstreamerConfig } returns "config" every { source.formats } returns formats + val pipeFormat = mockk(relaxed = true) + every { formats[0].delegate } returns pipeFormat + every { pipeFormat.itag } returns 140 + val pipeInfo = mockk(relaxed = true) + every { source.delegate } returns pipeInfo + every { pipeInfo.profile } returns PipeProfile.WEB + every { pipeInfo.videoId } returns "video" + every { pipeInfo.cpn } returns "stale" + every { pipeInfo.clientVersion } returns "1.2.3" + every { pipeInfo.visitorData } returns "visitor" + every { pipeInfo.serverAbrStreamingUrl } returns "https://example.com/sabr?cpn=stale&foo=bar" + every { pipeInfo.videoPlaybackUstreamerConfig } returns "config" + every { pipeInfo.formats } returns listOf(pipeFormat) val first = SabrSessionIdentity.fresh(source) val second = SabrSessionIdentity.fresh(source) @@ -31,6 +47,6 @@ class SabrSessionIdentityTest { assertEquals(first.cpn, first.serverAbrStreamingUrl!!.toHttpUrl().queryParameter("cpn")) assertEquals(second.cpn, second.serverAbrStreamingUrl!!.toHttpUrl().queryParameter("cpn")) assertEquals("bar", first.serverAbrStreamingUrl!!.toHttpUrl().queryParameter("foo")) - assertSame(formats[0], first.formats[0]) + assertEquals(formats[0].itag, first.formats[0].itag) } } From 3a60872c457478640a7f7c1af7f8c61ed6fd5a91 Mon Sep 17 00:00:00 2001 From: Priveetee Date: Fri, 4 Sep 2026 11:56:58 +0200 Subject: [PATCH 09/12] test: enforce SABR adapter boundary --- build.gradle.kts | 21 +++++++ .../server/sabr/SabrBoundaryContractTest.kt | 60 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 src/test/kotlin/dev/typetype/server/sabr/SabrBoundaryContractTest.kt diff --git a/build.gradle.kts b/build.gradle.kts index 9789023e..c77bb2e5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -145,8 +145,29 @@ tasks.jacocoTestCoverageVerification { } } +val verifySabrBoundary = tasks.register("verifySabrBoundary") { + doLast { + val adapterRoot = file("src/main/kotlin/dev/typetype/server/sabr") + .canonicalFile + .toPath() + val violations = fileTree("src/main/kotlin") + .matching { include("**/*.kt") } + .files + .filterNot { it.canonicalFile.toPath().startsWith(adapterRoot) } + .flatMap { source -> + source.readLines().withIndex() + .filter { it.value.contains("org.schabi.newpipe.extractor.services.youtube.sabr") } + .map { "${source.path}:${it.index + 1}" } + } + check(violations.isEmpty()) { + "PipePipe SABR imports must stay in the TypeType adapter: ${violations.joinToString()}" + } + } +} + tasks.check { dependsOn(tasks.jacocoTestCoverageVerification) + dependsOn(verifySabrBoundary) } kotlin { diff --git a/src/test/kotlin/dev/typetype/server/sabr/SabrBoundaryContractTest.kt b/src/test/kotlin/dev/typetype/server/sabr/SabrBoundaryContractTest.kt new file mode 100644 index 00000000..a6b4da07 --- /dev/null +++ b/src/test/kotlin/dev/typetype/server/sabr/SabrBoundaryContractTest.kt @@ -0,0 +1,60 @@ +package dev.typetype.server.sabr + +import io.mockk.every +import io.mockk.mockk +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.Test +import org.schabi.newpipe.extractor.services.youtube.sabr.SabrBufferedRange as PipeRange +import org.schabi.newpipe.extractor.services.youtube.sabr.YoutubeSabrFormat as PipeFormat + +class SabrBoundaryContractTest { + @Test + fun `format exposes the current extractor contract without loss`() { + val pipe = mockk(relaxed = true) + every { pipe.isAudio } returns false + every { pipe.isVideo } returns true + every { pipe.itag } returns 137 + every { pipe.width } returns 1920 + every { pipe.height } returns 1080 + every { pipe.bitrate } returns 4_000_000 + every { pipe.mimeType } returns "video/mp4" + every { pipe.initializationUrl } returns "https://example.test/init" + + val format = YoutubeSabrFormat(pipe) + + assertFalse(format.isAudio) + assertTrue(format.isVideo) + assertEquals(137, format.itag) + assertEquals(1920, format.width) + assertEquals(1080, format.height) + assertEquals(4_000_000, format.bitrate) + assertEquals("video/mp4", format.mimeType) + assertEquals("https://example.test/init", format.initializationUrl) + } + + @Test + fun `buffered range preserves timing and segment identity`() { + val pipe = mockk(relaxed = true) + every { pipe.itag } returns 137 + every { pipe.lastModified } returns 42L + every { pipe.xtags } returns "xtags" + every { pipe.startTimeMs } returns 1_000L + every { pipe.durationMs } returns 4_000L + every { pipe.startSegmentIndex } returns 3 + every { pipe.endSegmentIndex } returns 7 + every { pipe.timescale } returns 1_000 + + val range = SabrBufferedRange.fromDelegate(pipe) + + assertEquals(137, range.itag) + assertEquals(42L, range.lastModified) + assertEquals("xtags", range.xtags) + assertEquals(1_000L, range.startTimeMs) + assertEquals(4_000L, range.durationMs) + assertEquals(3, range.startSegmentIndex) + assertEquals(7, range.endSegmentIndex) + assertEquals(1_000, range.timescale) + } +} From 9f570c74bf92f1bd3f1d58f92a483638d06492f0 Mon Sep 17 00:00:00 2001 From: Priveetee Date: Sun, 6 Sep 2026 12:34:00 +0200 Subject: [PATCH 10/12] fix: return a typed error for oversized portability uploads --- openapi/paths/portability.yaml | 8 +++- .../kotlin/dev/typetype/server/Plugins.kt | 7 ++++ .../routes/PortabilityMultipartFailure.kt | 10 +++++ .../server/routes/PortabilityRouteSupport.kt | 5 +++ .../server/PortabilityMultipartFailureTest.kt | 38 +++++++++++++++++++ 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/dev/typetype/server/routes/PortabilityMultipartFailure.kt create mode 100644 src/test/kotlin/dev/typetype/server/PortabilityMultipartFailureTest.kt diff --git a/openapi/paths/portability.yaml b/openapi/paths/portability.yaml index 060de475..db938723 100644 --- a/openapi/paths/portability.yaml +++ b/openapi/paths/portability.yaml @@ -16,6 +16,11 @@ PortabilityImports: post: tags: [portability] summary: Upload and analyze an account backup + description: | + Accepts one backup of at most 512 MiB. For large YouTube Takeout exports, + clients can package only the YouTube CSV, HTML and JSON metadata, preserving + entry paths and excluding uploaded media and unrelated Google products. + The server still validates the archive and parses all imported records. parameters: - name: format in: query @@ -39,7 +44,8 @@ PortabilityImports: schema: { $ref: ../components/portability.yaml#/PortabilityJobSnapshot } '400': { description: Invalid or unrecognized backup } '401': { description: Missing or invalid token } - '413': { description: Upload exceeds the configured limit } + '413': + description: Upload exceeds 512 MiB (portability_upload_too_large) PortabilityExports: post: tags: [portability] diff --git a/src/main/kotlin/dev/typetype/server/Plugins.kt b/src/main/kotlin/dev/typetype/server/Plugins.kt index 63c900d5..ef71d1cf 100644 --- a/src/main/kotlin/dev/typetype/server/Plugins.kt +++ b/src/main/kotlin/dev/typetype/server/Plugins.kt @@ -1,6 +1,8 @@ package dev.typetype.server import dev.typetype.server.models.ErrorResponse +import dev.typetype.server.routes.isMultipartSizeLimit +import dev.typetype.server.routes.respondPortabilityError import dev.typetype.server.services.AuthService import io.ktor.http.HttpHeaders import io.ktor.http.HttpMethod @@ -118,6 +120,11 @@ internal fun Application.configureStatusPages() { exception { call, cause -> if (cause is io.ktor.utils.io.ClosedWriteChannelException) return@exception if (cause is kotlinx.coroutines.CancellationException) throw cause + // Ktor's multipart producer can fail outside the route's receive block. + if (call.request.path() == "/portability/imports" && cause.isMultipartSizeLimit()) { + call.respondPortabilityError(dev.typetype.server.portability.PortabilityUploadTooLargeException()) + return@exception + } log.error("Unhandled exception requestId=${call.requestId()} path=${call.request.path()}", cause) call.respond(HttpStatusCode.InternalServerError, ErrorResponse("Internal server error", "internal_error")) } diff --git a/src/main/kotlin/dev/typetype/server/routes/PortabilityMultipartFailure.kt b/src/main/kotlin/dev/typetype/server/routes/PortabilityMultipartFailure.kt new file mode 100644 index 00000000..a9751289 --- /dev/null +++ b/src/main/kotlin/dev/typetype/server/routes/PortabilityMultipartFailure.kt @@ -0,0 +1,10 @@ +package dev.typetype.server.routes + +import java.io.IOException + +internal fun Throwable.isMultipartSizeLimit(): Boolean = this is IOException && ( + message?.let { + (it.startsWith("Multipart content length exceeds limit ") && "formFieldLimit" in it) || + (it.startsWith("Limit of ") && " bytes exceeded while searching for " in it) + } == true +) diff --git a/src/main/kotlin/dev/typetype/server/routes/PortabilityRouteSupport.kt b/src/main/kotlin/dev/typetype/server/routes/PortabilityRouteSupport.kt index 28ac1d61..11c9bd47 100644 --- a/src/main/kotlin/dev/typetype/server/routes/PortabilityRouteSupport.kt +++ b/src/main/kotlin/dev/typetype/server/routes/PortabilityRouteSupport.kt @@ -17,6 +17,11 @@ internal fun parsePortabilityFormat(value: String?): PortabilityFormat? { } internal suspend fun ApplicationCall.respondPortabilityError(error: Exception) { + if (error is kotlinx.coroutines.CancellationException) throw error + if (error.isMultipartSizeLimit()) { + respondPortabilityError(PortabilityUploadTooLargeException()) + return + } val status = when (error) { is PortabilityJobNotFoundException -> HttpStatusCode.NotFound is PortabilityUploadTooLargeException -> HttpStatusCode.PayloadTooLarge diff --git a/src/test/kotlin/dev/typetype/server/PortabilityMultipartFailureTest.kt b/src/test/kotlin/dev/typetype/server/PortabilityMultipartFailureTest.kt new file mode 100644 index 00000000..62357677 --- /dev/null +++ b/src/test/kotlin/dev/typetype/server/PortabilityMultipartFailureTest.kt @@ -0,0 +1,38 @@ +package dev.typetype.server + +import dev.typetype.server.cache.CacheJson +import io.ktor.client.request.post +import io.ktor.client.statement.bodyAsText +import io.ktor.http.HttpStatusCode +import io.ktor.serialization.kotlinx.json.json +import io.ktor.server.application.install +import io.ktor.server.plugins.contentnegotiation.ContentNegotiation +import io.ktor.server.routing.post +import io.ktor.server.routing.routing +import io.ktor.server.testing.testApplication +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.Test +import java.io.IOException + +class PortabilityMultipartFailureTest { + @Test + fun `multipart scanner limit is a typed 413 not a 500`() = testApplication { + application { + install(ContentNegotiation) { json(CacheJson) } + configureStatusPages() + routing { + post("/portability/imports") { + throw IOException("Limit of 536870912 bytes exceeded while searching for boundary") + } + post("/unrelated") { + throw IOException("disk failure") + } + } + } + val response = client.post("/portability/imports") + assertEquals(HttpStatusCode.PayloadTooLarge, response.status) + assertTrue(response.bodyAsText().contains("portability_upload_too_large")) + assertEquals(HttpStatusCode.InternalServerError, client.post("/unrelated").status) + } +} From d797660167605682af52ab308355b932e5d1804a Mon Sep 17 00:00:00 2001 From: Priveetee Date: Sun, 6 Sep 2026 12:34:00 +0200 Subject: [PATCH 11/12] test: add opt-in Takeout archive upload reproduction --- .../PortabilityArchiveReproductionTest.kt | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/test/kotlin/dev/typetype/server/PortabilityArchiveReproductionTest.kt diff --git a/src/test/kotlin/dev/typetype/server/PortabilityArchiveReproductionTest.kt b/src/test/kotlin/dev/typetype/server/PortabilityArchiveReproductionTest.kt new file mode 100644 index 00000000..56ff39a1 --- /dev/null +++ b/src/test/kotlin/dev/typetype/server/PortabilityArchiveReproductionTest.kt @@ -0,0 +1,90 @@ +package dev.typetype.server + +import dev.typetype.server.cache.CacheJson +import dev.typetype.server.portability.* +import dev.typetype.server.routes.portabilityRoutes +import dev.typetype.server.services.AuthService +import io.ktor.client.request.forms.* +import io.ktor.client.request.* +import io.ktor.client.statement.bodyAsText +import io.ktor.http.* +import io.ktor.serialization.kotlinx.json.json +import io.ktor.server.application.install +import io.ktor.server.plugins.contentnegotiation.ContentNegotiation +import io.ktor.server.routing.routing +import io.ktor.server.testing.testApplication +import kotlinx.coroutines.* +import kotlinx.io.asSource +import kotlinx.io.buffered +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable +import org.junit.jupiter.api.io.TempDir +import java.nio.file.Files +import java.nio.file.Path + +@EnabledIfEnvironmentVariable(named = "PORTABILITY_REPRO_ARCHIVE", matches = ".+") +class PortabilityArchiveReproductionTest { + @TempDir + lateinit var directory: Path + + @Test + fun `real archive reaches preview without account writes`() = testApplication { + val archive = Path.of(System.getenv("PORTABILITY_REPRO_ARCHIVE")) + val data = object : PortabilityDataPort { + override suspend fun import( + userId: String, + source: PortabilityRecordSource, + request: PortabilityImportRequest, + onCategoryComplete: (PortabilityCategory, Long) -> Unit, + ): Map = error("Account writes are forbidden in this probe") + + override suspend fun export( + userId: String, + categories: Set, + sink: PortabilityRecordSink, + onCategoryComplete: (PortabilityCategory, Long) -> Unit, + ) = error("Account reads are forbidden in this probe") + } + val engine = PortabilityEngine( + PortabilityRegistry(listOf(YoutubeTakeoutPortabilityAdapter())), data, + PortabilityJobStore(directory.resolve("jobs")), + CoroutineScope(SupervisorJob() + Dispatchers.Default), + ) + application { + install(ContentNegotiation) { json(CacheJson) } + configureStatusPages() + routing { portabilityRoutes(engine, AuthService.fixed("owner")) } + } + try { + val response = client.post("/portability/imports?format=youtube-takeout") { + header(HttpHeaders.Authorization, "Bearer test-jwt") + setBody(MultiPartFormDataContent(formData { + append("file", InputProvider(Files.size(archive)) { + Files.newInputStream(archive).asSource().buffered() + }, Headers.build { + append(HttpHeaders.ContentDisposition, "filename=takeout.zip") + append(HttpHeaders.ContentType, "application/zip") + }) + })) + } + val body = response.bodyAsText() + if (Files.size(archive) > PortabilityLimits.MAX_UPLOAD_BYTES) { + assertEquals(HttpStatusCode.PayloadTooLarge, response.status, body) + return@testApplication + } + assertEquals(HttpStatusCode.Accepted, response.status, body) + val id = CacheJson.decodeFromString(body).id + withTimeout(120_000) { + while (engine.snapshot("owner", id).state in setOf( + PortabilityJobState.QUEUED, PortabilityJobState.ANALYZING, + )) delay(100) + } + val result = engine.snapshot("owner", id) + assertEquals(PortabilityJobState.READY, result.state, result.errorMessage) + println("Archive preview counts: ${result.preview?.counts}") + } finally { + engine.close() + } + } +} From ca8b6d04af32eea55de310be8a5c7f8cabc4b1c4 Mon Sep 17 00:00:00 2001 From: Priveetee Date: Mon, 7 Sep 2026 14:48:50 +0200 Subject: [PATCH 12/12] chore: prepare server 1.8.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 2de0665a..a73ffe8c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx2g -XX:+UseG1GC kotlin.code.style=official -appVersion=1.7.1 +appVersion=1.8.0 systemProp.sun.net.client.defaultReadTimeout=180000 systemProp.sun.net.client.defaultConnectTimeout=60000