Skip to content

Commit 0aa680e

Browse files
committed
3.1.7
1 parent 3593eb5 commit 0aa680e

File tree

7 files changed

+84
-61
lines changed

7 files changed

+84
-61
lines changed

app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ android {
1515
minSdkVersion 21
1616
targetSdkVersion 34
1717
versionCode 54
18-
versionName "3.1.6"
18+
versionName "3.1.7"
1919
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2020
}
2121

app/src/main/java/com/lagradost/quicknovel/BookDownloader2.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,7 @@ object BookDownloader2 {
15561556
val totalBytes = ArrayList<Byte>()
15571557
var progress = 0
15581558
val startedTime = System.currentTimeMillis()
1559-
1559+
file.parentFile?.mkdirs()
15601560
file.createNewFile()
15611561
val size = DEFAULT_BUFFER_SIZE
15621562
var lastUpdatedMs = 0L

app/src/main/java/com/lagradost/quicknovel/providers/AnnasArchive.kt

+26-8
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import com.lagradost.quicknovel.MainAPI
99
import com.lagradost.quicknovel.MainActivity.Companion.app
1010
import com.lagradost.quicknovel.SearchResponse
1111
import com.lagradost.quicknovel.fixUrlNull
12-
import com.lagradost.quicknovel.mvvm.logError
1312
import com.lagradost.quicknovel.newEpubResponse
13+
import com.lagradost.quicknovel.newSearchResponse
14+
import org.jsoup.Jsoup
1415

1516
class AnnasArchive : MainAPI() {
1617
override val hasMainPage = false
@@ -23,13 +24,17 @@ class AnnasArchive : MainAPI() {
2324

2425
override suspend fun search(query: String): List<SearchResponse> {
2526
val url = "$mainUrl/search?lang=&content=&ext=epub&sort=&q=$query"
26-
27-
val document = app.get(url).document
27+
// they somehow comment out the shit????
28+
val text = app.get(url).text.replace(Regex("<!--([\\W\\w]*?)-->")) {
29+
it.groupValues[1]
30+
}
31+
val document = Jsoup.parse(text)
2832
return document.select("div.mb-4 > div > a").mapNotNull { element ->
2933
val href = fixUrlNull(element.attr("href")) ?: return@mapNotNull null
30-
val poster = fixUrlNull(element.selectFirst("div.flex-none > div > img")?.attr("src"))
3134
val name = element.selectFirst("div.relative > h3")?.text() ?: return@mapNotNull null
32-
SearchResponse(name = name, url = href, posterUrl = poster, apiName = this.name)
35+
newSearchResponse(name = name, url = href) {
36+
posterUrl = fixUrlNull(element.selectFirst("div.flex-none > div > img")?.attr("src"))
37+
}
3338
}
3439
}
3540

@@ -69,26 +74,39 @@ class AnnasArchive : MainAPI() {
6974
}
7075

7176
override suspend fun load(url: String): LoadResponse {
77+
/* cloudflare
7278
val md5Prefix = "$mainUrl/md5/"
7379
if (url.startsWith(md5Prefix)) {
7480
try {
7581
return loadFromJsonUrl(url.removePrefix(md5Prefix))
7682
} catch (t: Throwable) {
7783
logError(t)
7884
}
79-
}
85+
}*/
8086

8187
// backup non json parser
8288
val document = app.get(url).document
8389

8490
return newEpubResponse(
8591
name = document.selectFirst("main > div > div.text-3xl")?.ownText()!!,
8692
url = url,
87-
links = document.select("div.mb-6 > ul.mb-4 > li > a").mapNotNull { element ->
93+
links = document.select("ul.mb-4 > li > a.js-download-link").mapNotNull { element ->
8894
val link = fixUrlNull(element.attr("href")) ?: return@mapNotNull null
95+
// member
96+
if (link.contains("fast_download")) {
97+
return@mapNotNull null
98+
}
99+
// cloudflare
100+
if (link.contains("slow_download")) {
101+
return@mapNotNull null
102+
}
103+
// no idea why this is in the js dl link
104+
if (link.endsWith("/datasets")) {
105+
return@mapNotNull null
106+
}
89107
extract(link, element.text())
90108
}) {
91-
posterUrl = document.selectFirst("main > div > img")?.attr("src")
109+
posterUrl = document.selectFirst("main > div > div > img")?.attr("src")
92110
author = document.selectFirst("main > div > div.italic")?.ownText()
93111
synopsis = document.selectFirst("main > div > div.js-md5-top-box-description")?.text()
94112
}

app/src/main/java/com/lagradost/quicknovel/providers/FreeWebNovelProvider.kt

+10-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class FreewebnovelProvider : LibReadProvider() {
1010
override val hasMainPage = true
1111
override val iconId = R.drawable.icon_freewebnovel
1212
override val iconBackgroundId = R.color.wuxiaWorldOnlineColor
13+
override val removeHtml = true
1314

1415
override suspend fun loadMainPage(
1516
page: Int,
@@ -36,6 +37,7 @@ class FreewebnovelProvider : LibReadProvider() {
3637

3738
override suspend fun loadHtml(url: String): String? {
3839
val response = app.get(url)
40+
3941
val document = Jsoup.parse(
4042
response.text
4143
.replace("New novel chapters are published on Freewebnovel.com.", "")
@@ -44,7 +46,14 @@ class FreewebnovelProvider : LibReadProvider() {
4446
""
4547
)
4648
)
47-
return document.selectFirst("div.txt>.notice-text")?.html()
49+
document.selectFirst("p")?.remove() // .m-read .txt sub, .m-read .txt p:nth-child(1)
50+
/*for (e in document.select("p")) {
51+
if (e.text().contains("The source of this ") || e.selectFirst("a")?.hasAttr("href") == true) {
52+
e.remove()
53+
}
54+
}*/
55+
document.selectFirst("div.txt>.notice-text")?.remove()
56+
return document.selectFirst("div.txt")?.html()
4857
}
4958
}
5059

app/src/main/java/com/lagradost/quicknovel/providers/LibReadProvider.kt

+9-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ open class LibReadProvider : MainAPI() {
99
override val name = "LibRead"
1010
override val mainUrl = "https://libread.com"
1111
override val hasMainPage = true
12+
open val removeHtml = false // because the two sites use .html or not for no reason
1213

1314
override val iconId = R.drawable.icon_libread
1415

@@ -119,6 +120,7 @@ open class LibReadProvider : MainAPI() {
119120
}
120121

121122
override suspend fun load(url: String): LoadResponse? {
123+
val trimmed = url.trim().removeSuffix("/")
122124
val response = app.get(url)
123125
val document = response.document
124126
val name = document.selectFirst("h1.tit")?.text() ?: return null
@@ -131,9 +133,15 @@ open class LibReadProvider : MainAPI() {
131133
)
132134
)
133135

136+
val prefix = if (removeHtml) {
137+
trimmed.removeSuffix(".html")
138+
} else {
139+
trimmed
140+
}
141+
134142
val data =
135143
Jsoup.parse(chaptersDataphp.text.replace("""\""", "")).select("option").map { c ->
136-
val cUrl = url + '/' + c.attr("value").split('/').last()
144+
val cUrl = "$prefix/${c.attr("value").split('/').last()}" // url + '/' +
137145
val cName = c.text().ifEmpty {
138146
"chapter $c"
139147
}

app/src/main/java/com/lagradost/quicknovel/providers/ReadNovelFullProvider.kt

+35-47
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import com.lagradost.quicknovel.MainActivity.Companion.app
55
import org.jsoup.Jsoup
66
import org.jsoup.nodes.Element
77

8-
class ReadNovelFullProvider : AllNovelProvider() { // todo check
8+
/*class ReadNovelFullProvider : AllNovelProvider() { // todo check
99
override val mainUrl = "https://readnovelfull.com"
1010
override val name = "ReadNovelFull"
1111
override val ajaxUrl = "ajax/chapter-archive"
12-
}
13-
/*
12+
}*/
13+
1414
class ReadNovelFullProvider : MainAPI() {
1515
override val mainUrl = "https://readnovelfull.com"
1616
override val name = "ReadNovelFull"
@@ -22,23 +22,20 @@ class ReadNovelFullProvider : MainAPI() {
2222
).document
2323

2424
val headers = document.select("div.col-novel-main > div.list-novel > div.row")
25-
if (headers.size <= 0) return emptyList()
2625

2726
return headers.mapNotNull { h ->
2827
val divs = h.select("> div > div")
2928
val poster = divs[0].selectFirst("> img")?.attr("src")?.replace("t-200x89", "t-300x439")
3029
val titleHeader = divs[1].selectFirst("> h3.novel-title > a")
3130
val href = titleHeader?.attr("href")
3231
val title = titleHeader?.text()
33-
val latestChapter = divs[2].selectFirst("> a > span")?.text()
34-
SearchResponse(
35-
title ?: return@mapNotNull null,
36-
fixUrl(href ?: return@mapNotNull null),
37-
fixUrlNull(poster),
38-
null,
39-
latestChapter,
40-
this.name
41-
)
32+
//val latestChapter = divs[2].selectFirst("> a > span")?.text()
33+
newSearchResponse(
34+
name = title ?: return@mapNotNull null,
35+
url = href ?: return@mapNotNull null
36+
) {
37+
posterUrl = fixUrlNull(poster)
38+
}
4239
}
4340
}
4441

@@ -56,19 +53,15 @@ class ReadNovelFullProvider : MainAPI() {
5653
val header = document.selectFirst("div.col-info-desc")
5754
val bookInfo = header?.selectFirst("> div.info-holder > div.books")
5855
val title = bookInfo?.selectFirst("> div.desc > h3.title")?.text()
59-
val poster = bookInfo?.selectFirst("> div.book > img")?.attr("src")
56+
6057
val desc = header?.selectFirst("> div.desc")
6158
val rateInfo = desc?.selectFirst("> div.rate-info")
62-
val votes =
63-
rateInfo?.select("> div.small > em > strong > span")?.last()?.text()?.toIntOrNull()
59+
6460
val rate = rateInfo?.selectFirst("> div.rate")
6561

6662
val novelId = rate?.selectFirst("> div#rating")?.attr("data-novel-id")
6763
?: throw Exception("novelId not found")
68-
val rating = rate.selectFirst("> input")?.attr("value")?.toFloatOrNull()?.times(100)
69-
?.toInt()
7064

71-
val syno = document.selectFirst("div.desc-text")?.text()
7265

7366
val infoMetas = desc.select("> ul.info-meta > li")
7467

@@ -81,42 +74,37 @@ class ReadNovelFullProvider : MainAPI() {
8174
return null
8275
}
8376

84-
val author = getData("Author:")?.selectFirst("> a")?.text()
85-
val tags = getData("Genre:")?.select("> a")?.map { it.text() }
86-
val statusText = getData("Status:")?.selectFirst("> a")?.text()
87-
val status = when (statusText) {
88-
"Ongoing" -> STATUS_ONGOING
89-
"Completed" -> STATUS_COMPLETE
90-
else -> STATUS_NULL
91-
}
92-
9377
val dataUrl = "$mainUrl/ajax/chapter-archive?novelId=$novelId"
9478
val dataResponse = app.get(dataUrl)
9579
val dataDocument =
9680
Jsoup.parse(dataResponse.text) ?: throw ErrorLoadingException("invalid dataDocument")
9781
val items =
9882
dataDocument.select("div.panel-body > div.row > div > ul.list-chapter > li > a")
9983
.mapNotNull {
100-
ChapterData(
101-
it.selectFirst("> span")?.text() ?: return@mapNotNull null,
102-
fixUrl(it.attr("href")),
103-
null,
104-
null
84+
newChapterData(
85+
name = it.selectFirst("> span")?.text() ?: return@mapNotNull null,
86+
url = it.attr("href") ?: return@mapNotNull null,
10587
)
10688
}
107-
return StreamResponse(
108-
url,
109-
title ?: throw ErrorLoadingException("No name"),
110-
items,
111-
author,
112-
poster,
113-
rating,
114-
votes,
115-
null,
116-
syno,
117-
tags,
118-
status
119-
)
89+
return newStreamResponse(
90+
name = title ?: throw ErrorLoadingException("No name"),
91+
url = url,
92+
data = items
93+
) {
94+
author = getData("Author:")?.selectFirst("> a")?.text()
95+
tags = getData("Genre:")?.select("> a")?.map { it.text() }
96+
val statusText = getData("Status:")?.selectFirst("> a")?.text()
97+
status = when (statusText) {
98+
"Ongoing" -> STATUS_ONGOING
99+
"Completed" -> STATUS_COMPLETE
100+
else -> STATUS_NULL
101+
}
102+
synopsis = document.selectFirst("div.desc-text")?.text()
103+
rating = rate.selectFirst("> input")?.attr("value")?.toFloatOrNull()?.times(100)
104+
?.toInt()
105+
peopleVoted =
106+
rateInfo.select("> div.small > em > strong > span")?.last()?.text()?.toIntOrNull()
107+
posterUrl = bookInfo.selectFirst("> div.book > img")?.attr("src")
108+
}
120109
}
121110
}
122-
*/

app/src/main/java/com/lagradost/quicknovel/util/Apis.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import com.lagradost.quicknovel.providers.*
1010

1111
class Apis {
1212
companion object {
13-
val apis: Array<MainAPI> = arrayOf(
13+
val apis: List<MainAPI> = arrayOf(
1414
//AllProvider(),
1515
// NovelPassionProvider(), // Site gone
1616
BestLightNovelProvider(),
@@ -48,7 +48,7 @@ class Apis {
4848
IndoWebNovelProvider(),
4949
SakuraNovelProvider(),
5050
WattpadProvider(),
51-
)
51+
).sortedBy { it.name }
5252

5353
fun getApiFromName(name: String): APIRepository {
5454
return getApiFromNameOrNull(name) ?: APIRepository(apis[1])

0 commit comments

Comments
 (0)