mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 16:30:31 +05:30
fix: ignore youtube import entries with missing title url
This commit is contained in:
parent
f4a8d7b6b1
commit
2c463da52a
@ -162,7 +162,8 @@ object ImportHelper {
|
||||
}
|
||||
|
||||
ImportFormat.FREETUBE -> {
|
||||
val playlistFile = activity.contentResolver.openInputStream(uri)?.use { inputStream ->
|
||||
val playlistFile =
|
||||
activity.contentResolver.openInputStream(uri)?.use { inputStream ->
|
||||
val text = inputStream.bufferedReader().readText()
|
||||
runCatching {
|
||||
text.lines().map { line ->
|
||||
@ -287,7 +288,7 @@ object ImportHelper {
|
||||
JsonHelper.json.decodeFromStream<List<YouTubeWatchHistoryFileItem>>(it)
|
||||
}
|
||||
.orEmpty()
|
||||
.filter { it.activityControls.contains("YouTube watch history") && it.subtitles.isNotEmpty() }
|
||||
.filter { it.activityControls.contains("YouTube watch history") && it.subtitles.isNotEmpty() && it.titleUrl.isNotEmpty() }
|
||||
.reversed()
|
||||
.map {
|
||||
val videoId = it.titleUrl.substring(it.titleUrl.length - 11)
|
||||
|
@ -4,10 +4,10 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class YouTubeWatchHistoryFileItem(
|
||||
val header: String,
|
||||
val time: String,
|
||||
val title: String,
|
||||
val titleUrl: String,
|
||||
val header: String = "",
|
||||
val time: String = "",
|
||||
val title: String = "",
|
||||
val titleUrl: String = "",
|
||||
val activityControls: List<String> = emptyList(),
|
||||
val products: List<String> = emptyList(),
|
||||
val subtitles: List<YouTubeWatchHistoryChannelInfo> = emptyList()
|
||||
|
Loading…
x
Reference in New Issue
Block a user