Merge pull request #6571 from Bnyro/master

fix: crash when importing private videos in watch history
This commit is contained in:
Bnyro 2024-10-02 11:54:33 +02:00 committed by GitHub
commit 54ca323bbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -269,7 +269,7 @@ object ImportHelper {
JsonHelper.json.decodeFromStream<List<YouTubeWatchHistoryFileItem>>(it)
}
.orEmpty()
.filter { it.activityControls.contains("YouTube watch history") }
.filter { it.activityControls.contains("YouTube watch history") && it.subtitles.isNotEmpty() }
.reversed()
.map {
val videoId = it.titleUrl.substring(it.titleUrl.length - 11)

View File

@ -4,11 +4,11 @@ import kotlinx.serialization.Serializable
@Serializable
data class YouTubeWatchHistoryFileItem(
val activityControls: List<String>,
val header: String,
val products: List<String>,
val subtitles: List<YouTubeWatchHistoryChannelInfo>,
val time: String,
val title: String,
val titleUrl: String
val titleUrl: String,
val activityControls: List<String> = emptyList(),
val products: List<String> = emptyList(),
val subtitles: List<YouTubeWatchHistoryChannelInfo> = emptyList()
)