-
Notifications
You must be signed in to change notification settings - Fork 203
Expand file tree
/
Copy pathCustomEverydayAnimeModel.kt
More file actions
64 lines (62 loc) · 2.99 KB
/
CustomEverydayAnimeModel.kt
File metadata and controls
64 lines (62 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.skyd.imomoe.model.impls.custom
import com.skyd.imomoe.bean.*
import com.skyd.imomoe.config.Api
import com.skyd.imomoe.model.util.JsoupUtil
import com.skyd.imomoe.model.interfaces.IEverydayAnimeModel
import org.jsoup.select.Elements
class CustomEverydayAnimeModel : IEverydayAnimeModel {
override suspend fun getEverydayAnimeData()
: Triple<ArrayList<TabBean>, ArrayList<List<AnimeCoverBean>>, AnimeShowBean> {
val tabList = ArrayList<TabBean>()
val header = AnimeShowBean(
"", "", "", "",
"", null, "", null
)
val everydayAnimeList: ArrayList<List<AnimeCoverBean>> = ArrayList()
val document = JsoupUtil.getDocument(Api.MAIN_URL)
val areaChildren: Elements = document.select("[class=area]")[0].children()
for (i in areaChildren.indices) {
when (areaChildren[i].className()) {
"side r" -> {
val sideRChildren = areaChildren[i].children()
out@ for (j in sideRChildren.indices) {
when (sideRChildren[j].className()) {
"bg" -> {
val bgChildren = sideRChildren[j].children()
for (k in bgChildren.indices) {
when (bgChildren[k].className()) {
"dtit" -> {
header.title = CustomParseHtmlUtil.parseDtit(bgChildren[k])
}
"tag" -> {
val tagChildren = bgChildren[k].children()
for (l in tagChildren.indices) {
tabList.add(
TabBean(
"",
"",
"",
tagChildren[l].text()
)
)
}
}
"tlist" -> {
everydayAnimeList.addAll(
CustomParseHtmlUtil.parseTlist(
bgChildren[k]
)
)
}
}
}
break@out
}
}
}
}
}
}
return Triple(tabList, everydayAnimeList, header)
}
}