-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature]支持DoH;此版本不再内置默认数据源,使用此APP需手动选择自定义数据源
- Loading branch information
SkyD666
committed
Dec 5, 2021
1 parent
e3af1c8
commit 712fdfe
Showing
82 changed files
with
1,683 additions
and
1,037 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.skyd.imomoe.bean | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import java.io.Serializable | ||
|
||
class DoHJsonBean( | ||
override var type: String = "", | ||
override var actionUrl: String = "", | ||
@SerializedName("Status") | ||
var status: Int, | ||
@SerializedName("TC") | ||
var tc: Boolean, | ||
@SerializedName("RD") | ||
var rd: Boolean, | ||
@SerializedName("RA") | ||
var ra: Boolean, | ||
@SerializedName("AD") | ||
var ad: Boolean, | ||
@SerializedName("CD") | ||
var cd: Boolean, | ||
@SerializedName("Question") | ||
var question: List<Question>, | ||
@SerializedName("Answer") | ||
var answer: List<Answer>?, | ||
@SerializedName("Comment") | ||
var comment: String?, | ||
@SerializedName("edns_client_subnet") | ||
var eDNSClientSubnet: String? | ||
) : BaseBean { | ||
class Question( | ||
@SerializedName("name") | ||
var name: String, | ||
@SerializedName("type") | ||
var type: Int | ||
) : Serializable | ||
|
||
class Answer( | ||
@SerializedName("name") | ||
var name: String, | ||
@SerializedName("type") | ||
var type: Int, | ||
@SerializedName("TTL") | ||
var ttl: Int, | ||
@SerializedName("data") | ||
var data: String | ||
) : Serializable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 1 addition & 162 deletions
163
app/src/main/java/com/skyd/imomoe/model/impls/AnimeDetailModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,173 +1,12 @@ | ||
package com.skyd.imomoe.model.impls | ||
|
||
import com.skyd.imomoe.bean.* | ||
import com.skyd.imomoe.config.Api | ||
import com.skyd.imomoe.config.Const | ||
import com.skyd.imomoe.model.util.JsoupUtil | ||
import com.skyd.imomoe.model.util.ParseHtmlUtil | ||
import com.skyd.imomoe.model.util.ParseHtmlUtil.parseBotit | ||
import com.skyd.imomoe.model.interfaces.IAnimeDetailModel | ||
import org.jsoup.select.Elements | ||
|
||
class AnimeDetailModel : IAnimeDetailModel { | ||
override suspend fun getAnimeDetailData( | ||
partUrl: String | ||
): Triple<ImageBean, String, ArrayList<IAnimeDetailBean>> { | ||
val animeDetailList: ArrayList<IAnimeDetailBean> = ArrayList() | ||
val cover = ImageBean("", "", "", "") | ||
var title = "" | ||
val url = Api.MAIN_URL + partUrl | ||
val document = JsoupUtil.getDocument(url) | ||
//番剧头部信息 | ||
val area: Elements = document.getElementsByClass("area") | ||
for (i in area.indices) { | ||
val areaChildren = area[i].children() | ||
for (j in areaChildren.indices) { | ||
when (areaChildren[j].className()) { | ||
"fire l" -> { | ||
var alias = "" | ||
var info = "" | ||
var year = "" | ||
var index = "" | ||
var animeArea = "" | ||
val animeType: MutableList<AnimeTypeBean> = ArrayList() | ||
val tag: MutableList<AnimeTypeBean> = ArrayList() | ||
|
||
val fireLChildren = | ||
areaChildren[j].select("[class=fire l]")[0].children() | ||
for (k in fireLChildren.indices) { | ||
when (fireLChildren[k].className()) { | ||
"thumb l" -> { | ||
cover.url = fireLChildren[k] | ||
.select("img").attr("src") | ||
cover.referer = url | ||
} | ||
"rate r" -> { | ||
val rateR = fireLChildren[k] | ||
title = rateR.select("h1").text() | ||
val sinfo: Elements = rateR.select("[class=sinfo]") | ||
val span: Elements = sinfo.select("span") | ||
val p: Elements = sinfo.select("p") | ||
if (p.size == 1) { | ||
alias = p[0].text() | ||
} else if (p.size == 2) { | ||
alias = p[0].text() | ||
info = p[1].text() | ||
} | ||
year = span[0].text() | ||
animeArea = span[1].select("a").text() | ||
index = span[3].select("a").text() | ||
val typeElements: Elements = span[2].select("a") | ||
for (l in typeElements.indices) { | ||
animeType.add( | ||
AnimeTypeBean( | ||
"", | ||
typeElements[l].attr("href"), | ||
Api.MAIN_URL + typeElements[l].attr("href"), | ||
typeElements[l].text() | ||
) | ||
) | ||
} | ||
val tagElements: Elements = span[4].select("a") | ||
for (l in tagElements.indices) { | ||
tag.add( | ||
AnimeTypeBean( | ||
"", | ||
tagElements[l].attr("href"), | ||
Api.MAIN_URL + tagElements[l].attr("href"), | ||
tagElements[l].text() | ||
) | ||
) | ||
} | ||
} | ||
"tabs", "tabs noshow" -> { //播放列表+header | ||
animeDetailList.add( | ||
AnimeDetailBean( | ||
Const.ViewHolderTypeString.HEADER_1, "", | ||
fireLChildren[k].select("[class=menu0]") | ||
.select("li").text(), | ||
"", | ||
null | ||
) | ||
) | ||
|
||
animeDetailList.add( | ||
AnimeDetailBean( | ||
Const.ViewHolderTypeString.HORIZONTAL_RECYCLER_VIEW_1, | ||
"", | ||
"", | ||
"", | ||
ParseHtmlUtil.parseMovurls( | ||
fireLChildren[k].select("[class=main0]") | ||
.select("[class=movurl]")[0] | ||
) | ||
) | ||
) | ||
} | ||
"botit" -> { //其它header | ||
animeDetailList.add( | ||
AnimeDetailBean( | ||
Const.ViewHolderTypeString.HEADER_1, "", | ||
parseBotit(fireLChildren[k]), | ||
"", | ||
null | ||
) | ||
) | ||
} | ||
"dtit" -> { //其它header | ||
animeDetailList.add( | ||
AnimeDetailBean( | ||
Const.ViewHolderTypeString.HEADER_1, "", | ||
ParseHtmlUtil.parseDtit(fireLChildren[k]), | ||
"", | ||
null | ||
) | ||
) | ||
} | ||
"info" -> { //动漫介绍 | ||
animeDetailList.add( | ||
AnimeDetailBean( | ||
Const.ViewHolderTypeString.ANIME_DESCRIBE_1, "", | ||
"", | ||
fireLChildren[k] | ||
.select("[class=info]").text(), | ||
null | ||
) | ||
) | ||
} | ||
"img" -> { //系列动漫推荐 | ||
animeDetailList.addAll( | ||
ParseHtmlUtil.parseImg(fireLChildren[k], url) | ||
) | ||
} | ||
} | ||
} | ||
val animeInfoBean = AnimeInfoBean( | ||
"", | ||
"", | ||
title, | ||
ImageBean("", "", cover.url, url), | ||
alias, | ||
animeArea, | ||
year, | ||
index, | ||
animeType, | ||
tag, | ||
info | ||
) | ||
animeDetailList.add( | ||
0, | ||
AnimeDetailBean( | ||
Const.ViewHolderTypeString.ANIME_INFO_1, "", | ||
"", | ||
"", | ||
headerInfo = animeInfoBean | ||
) | ||
) | ||
} | ||
} | ||
} | ||
} | ||
return Triple(cover, title, animeDetailList) | ||
return Triple(ImageBean("", "", "", ""), "", ArrayList()) | ||
} | ||
} |
Oops, something went wrong.