youpipe: fall back to now when a video has no upload date
- Commit
ea14dc061bc23d194bcb55d4123642a92a6ca423- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-08 02:24 UTC (28 days ago)
- Parents
d27ffdb
buildVideoData force-unwrapped ex.getUploadDate(), but YoutubeStreamExtractor.getUploadDate() is nullable: DateWrapper.fromOffsetDateTime(null) returns null whenever getTextualUploadDate() is null (live streams with no start/end timestamp in the player response, upcoming streams). The !! threw, loadSafely caught it, and a video that extracted fine showed "Video load error".\n\nFall back to Clock.System.now() so date-less videos still load.\n\nVerified: :youpipe:testDevUnitTest green (241 tests, BUILD SUCCESSFUL).
Diff
youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeVideoLoading.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeVideoLoading.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeVideoLoading.ktindex d3aadd7125..230d4596cc 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeVideoLoading.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeVideoLoading.kt@@ -114,7 +114,9 @@ private fun buildVideoData( ex.getName().decodeHtml(), ex.getViewCount(), ex.getLength(),- ex.getUploadDate()!!.instant.toKotlinInstant(),+ // Live/upcoming videos may carry no upload date (extractor returns null);+ // fall back to now rather than failing a load that extracted fine.+ ex.getUploadDate()?.instant?.toKotlinInstant() ?: Clock.System.now(), ex.getThumbnails().first().url, ex.getUploaderName().decodeHtml(), channelURLtoID(ex.getUploaderUrl()),