diff --git a/app/src/main/java/xyz/quaver/pupil/sources/manatoki/util.kt b/app/src/main/java/xyz/quaver/pupil/sources/manatoki/util.kt index 38eb39cf..f6c0738c 100644 --- a/app/src/main/java/xyz/quaver/pupil/sources/manatoki/util.kt +++ b/app/src/main/java/xyz/quaver/pupil/sources/manatoki/util.kt @@ -144,7 +144,7 @@ suspend fun HttpClient.getItem( }.toString() val urls = Jsoup.parse(htmlData) - .select("img[^data-]:not([style])") + .select("img[^data-]:not([style]):not([^class])") .map { it.attributes() .first { it.key.startsWith("data-") } diff --git a/app/src/main/java/xyz/quaver/pupil/util/NetworkCache.kt b/app/src/main/java/xyz/quaver/pupil/util/NetworkCache.kt index 187df3b2..2c2ca63d 100644 --- a/app/src/main/java/xyz/quaver/pupil/util/NetworkCache.kt +++ b/app/src/main/java/xyz/quaver/pupil/util/NetworkCache.kt @@ -123,7 +123,7 @@ class NetworkCache(context: Context) : DIAware { requests[url] = networkScope.launch { runCatching { - if (file.exists()) { + if (!force && file.exists()) { progressFlow.emit(Float.POSITIVE_INFINITY) } else { cacheDir.mkdirs() diff --git a/app/src/test/java/xyz/quaver/pupil/ExampleUnitTest.kt b/app/src/test/java/xyz/quaver/pupil/ExampleUnitTest.kt index 233e4a8f..8da394bc 100644 --- a/app/src/test/java/xyz/quaver/pupil/ExampleUnitTest.kt +++ b/app/src/test/java/xyz/quaver/pupil/ExampleUnitTest.kt @@ -24,6 +24,7 @@ import io.ktor.client.* import kotlinx.coroutines.runBlocking import org.junit.Test import xyz.quaver.pupil.sources.manatoki.getItem +import org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). @@ -35,7 +36,7 @@ class ExampleUnitTest { @Test fun test() { - val itemID = 232566 + val itemID = 145360 val client = HttpClient() @@ -43,7 +44,29 @@ class ExampleUnitTest { client.getItem( itemID.toString(), onReader = { - print(it) + assertEquals( + listOf( + "https://newtoki15.org/data/editor/1901/1077963982_tTXMCveG_fb60ec5a563ca8ab9fd5297aee678f0753001844", + "https://newtoki15.org/data/editor/1901/1077963982_gkhHpOSi_49d9003f22e05d7a70b9b877d105a9496cb382b6", + "https://newtoki15.org/data/editor/1901/1077963982_1IUNPaSk_fe889333f982b2f85ffdcc8eaf7d1ec435cae4d8", + "https://newtoki15.org/data/editor/1901/1077963982_DdnS7iux_a72d128adb7334bd2aa45fa0ebc888405d2d6158", + "https://newtoki15.org/data/editor/1901/1077963982_vLQun9me_76a6914ff06c6b9df3ed69d43524e5b7eb7d063c", + "https://newtoki15.org/data/editor/1901/1077963982_hRnmqsBz_47695027ed3c1e039bd61a4bd059bd977218dceb", + "https://newtoki15.org/data/editor/1901/1077963982_aQB3cyXP_bbc55416bed60989c57150ce8d1dd7476e7e4573", + "https://newtoki15.org/data/editor/1901/1077963982_4ulxFtgy_50d903e92bc4e4e610c65d2f67d46ec679abb3b1", + "https://newtoki15.org/data/editor/1901/1077963982_Jf8cvnm6_9fe96de962feaffe72bc96be1e1255bb50d1ec6a", + "https://newtoki15.org/data/editor/1901/1077963982_C7rUVlhL_f968ff4e44e850bc38e9e18f0ef25b5cc3de376f", + "https://newtoki15.org/data/editor/1901/1077963982_pEJB2Fl7_095351ba621239059891f3f41476de529014b17e", + "https://newtoki15.org/data/editor/1901/1077963982_6PN0QgvO_ed11c8baeb3565d86b3563d7760beee10d302364", + "https://newtoki15.org/data/editor/1901/1077963982_s73REfCc_c373538bf02c14dc7d9f195b2893c50380cfd74f", + "https://newtoki15.org/data/editor/1901/1077963982_UxiyBoPO_4cb9f733c9bab6552f380ce49f7ec9fc5a35e0a7", + "https://newtoki15.org/data/editor/1901/1077963982_VHa1wSsp_94be272f1947be8731b474aaf966d2395ed32a4e", + "https://newtoki15.org/data/editor/1901/1077963982_hXrkCWlN_ed908b9d1febbb875ce79d04fd52bdb9132ff980", + "https://newtoki15.org/data/editor/1901/1077963982_voBeugVP_a491b8fdf4dc033a7cb0393fbafd8d505eb776b9", + "https://newtoki15.org/data/editor/1901/1077963982_ZVCMAjoJ_29eca6af62de41b228590e61748208572c78db61" + ), + it.urls + ) } ) }