Skip to content

Commit

Permalink
[release] 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
heyanLE committed Jan 28, 2024
1 parent 078441d commit c3f142a
Show file tree
Hide file tree
Showing 80 changed files with 4,475 additions and 27 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: release
on:
push:
tags:
- '**'
workflow_dispatch:
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 17
- name: Build
run: |
chmod +x ./gradlew
./gradlew :app:assemble
- name: sign-apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PWD }}
keyPassword: ${{ secrets.KEY_PWD }}
- name: rename-apk
run: |
mv app/build/outputs/apk/release/extension-app-release-unsigned-signed.apk extension-app-${{ github.ref_name }}.apk
- name: Release
run: |
gh release create -d ${{ github.ref_name }} extension-app-${{ github.ref_name }}.apk
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
<img alt="license" src="https://img.shields.io/github/license/easybangumiorg/EasyBangumiExtension" />
</p>

本项目为纯纯看番拓展二次开发模板使用。
本仓库内容均来自互联网投稿,为了代码安全性只收录提交到纯纯看番官方的代码,并由官方编译。

如果使用其他的源,用户需要自己甄别插件安全性,纯纯看番官方无法保证这些插件是否安全。

如果本仓库内容您认为侵犯了你的权益,请提交issue联系我们删除。

纯纯看番本体:[https://github.com/easybangumiorg/EasyBangumi](https://github.com/easybangumiorg/EasyBangumi)


开发文档:~~还在写~~

7 changes: 4 additions & 3 deletions extension-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ plugins {
}

// 包名
val packageName = ""
val packageName = "org.easybangumi.extension"

// 库版本,目前 5.0.3 支持的库版本为 3 到 5
val extensionLibVersion = 5
val extensionLibVersion = 6

android {
namespace = packageName
Expand All @@ -20,7 +20,7 @@ android {
versionCode = 1
versionName = "1.0"

manifestPlaceholders.put("extensionLibVersion", 4)
manifestPlaceholders.put("extensionLibVersion", extensionLibVersion)

}

Expand All @@ -45,5 +45,6 @@ android {


dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")
compileOnly("io.github.easybangumiorg:extension-api:1.${extensionLibVersion}-SNAPSHOT")
}
4 changes: 2 additions & 2 deletions extension-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<application
android:allowBackup="true"
android:icon="@mipmap/app_logo"
android:label="[APP 名称]"
android:label="纯纯看番社区插件"
android:supportsRtl="true">


Expand All @@ -19,7 +19,7 @@
<!--source-->
<meta-data
android:name="easybangumi.extension.source"
android:value="com.heyanle.easybangumi_extension.EasySourceFactory"/>
android:value="org.easybangumi.extension.EasySourceFactory"/>

<!--为了让本体能找到需要加-->
<activity android:name="com.heyanle.extension_api.NoneActivity"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
package com.heyanle.easybangumi_extension.anfun

import android.util.Log
import com.heyanle.easybangumi4.source_api.ParserException
import com.heyanle.easybangumi4.source_api.SourceResult
import com.heyanle.easybangumi4.source_api.component.ComponentWrapper
import com.heyanle.easybangumi4.source_api.component.detailed.DetailedComponent
import com.heyanle.easybangumi4.source_api.component.play.PlayComponent
import com.heyanle.easybangumi4.source_api.component.update.UpdateComponent
import com.heyanle.easybangumi4.source_api.entity.Cartoon
import com.heyanle.easybangumi4.source_api.entity.CartoonImpl
import com.heyanle.easybangumi4.source_api.entity.CartoonSummary
import com.heyanle.easybangumi4.source_api.entity.Episode
import com.heyanle.easybangumi4.source_api.entity.PlayLine
import com.heyanle.easybangumi4.source_api.entity.PlayerInfo
import com.heyanle.easybangumi4.source_api.utils.api.OkhttpHelper
import com.heyanle.easybangumi4.source_api.utils.api.WebViewHelper
import com.heyanle.easybangumi4.source_api.utils.core.SourceUtils
import com.heyanle.easybangumi4.source_api.utils.core.network.GET
import com.heyanle.easybangumi4.source_api.withResult
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withTimeoutOrNull
import org.jsoup.Jsoup
import org.jsoup.nodes.Document

/**
* Created by heyanle on 2024/1/29.
* https://github.com/heyanLE
*/
class AnfunDetailedComponent(
private val okhttpHelper: OkhttpHelper,
private val webViewHelper: WebViewHelper
): ComponentWrapper(), DetailedComponent, UpdateComponent, PlayComponent {


override suspend fun getDetailed(summary: CartoonSummary): SourceResult<Cartoon> {
return withResult(Dispatchers.IO) {
detailed(getDoc(summary), summary)
}
}

override suspend fun getPlayLine(summary: CartoonSummary): SourceResult<List<PlayLine>> {
return withResult(Dispatchers.IO) {
playLine(getDoc(summary), summary)
}
}

override suspend fun getAll(summary: CartoonSummary): SourceResult<Pair<Cartoon, List<PlayLine>>> {
return withResult(Dispatchers.IO) {
detailed(getDoc(summary), summary) to playLine(getDoc(summary), summary)
}
}

override suspend fun update(
cartoon: Cartoon,
oldPlayLine: List<PlayLine>
): SourceResult<Cartoon> {
return withResult(Dispatchers.IO) {

when (val n = getAll(CartoonSummary(cartoon.id, cartoon.source))) {
is SourceResult.Complete -> {
n.data.first.apply {

val newPlayLine = n.data.second

if (oldPlayLine.size != newPlayLine.size) {
isUpdate = true
} else {
isUpdate = false
for (i in oldPlayLine.indices) {
if (oldPlayLine[i].episode.size != newPlayLine[i].episode.size) {
isUpdate = true
break
}
}
}
}
}
is SourceResult.Error -> {
throw n.throwable
}
}
}
}

private fun getDoc(summary: CartoonSummary): Document {
val d = okhttpHelper.cloudflareWebViewClient.newCall(GET(SourceUtils.urlParser(AnfunSource.ROOT_URL, "/anime/${summary.id}.html")))
.execute().body?.string() ?: throw NullPointerException()
return Jsoup.parse(d)
}
private fun playLine(document: Document, summary: CartoonSummary): List<PlayLine> {
Log.e("TAG","------->>>>>>>playLine")
val res = arrayListOf<PlayLine>()
val module = document.select(".hl-play-source").first() ?: return res
val playNameList = module.select(".hl-plays-wrap").first()?.select("a") ?: return res
val playEpisodeList = module.select(".hl-tabs-box")
for (index in 0..playNameList.size) {
val playName = playNameList.getOrNull(index)?.text()
val playEpisode = playEpisodeList.getOrNull(index)
if (playName != null && playEpisode != null) {
val results = playEpisode.select("li").select("a")
val es = arrayListOf<Episode>()

for (i in results.indices) {
es.add(Episode((i+1).toString(), results[i].text(), i)) // title

}
val playLine = PlayLine(
id = (index + 1).toString(),
label = playName,
episode = es
)
res.add(playLine)
}
}
return res
}

override suspend fun getPlayInfo(
summary: CartoonSummary,
playLine: PlayLine,
episode: Episode
): SourceResult<PlayerInfo> {
Log.e("TAG","------->>>>>>>开始播放")
return withResult(Dispatchers.IO) {

// Log.e("TAG","${playUrlTemp[playLine.id.toInt()]}") // [/play/632-1-1.html]
val url = SourceUtils.urlParser(AnfunSource.ROOT_URL, "/play/${summary.id}-${playLine.id}-${episode.id}")
// Log.e("TAG", url) // https://www.anfuns.cc/play/632-1-1.html
var videoUrl = webViewHelper.interceptResource(
url, regex = "https://www.anfuns.cc/vapi/AIRA/mui.php?.*"
)
Log.e("TAG", "地址:$videoUrl")
if (videoUrl.isNotEmpty()) {
when {
videoUrl.contains(".m3u8&") -> videoUrl = videoUrl.substringAfter("url=")
.substringBefore("&")
videoUrl.contains(".mp4") -> videoUrl = videoUrl.substringAfter("url=")
.substringBefore("&next=")
}
Log.e("TAG", "解析后url:$videoUrl")
if (videoUrl.indexOf(".mp4") != -1){
PlayerInfo(
decodeType = PlayerInfo.DECODE_TYPE_OTHER,
uri = SourceUtils.urlParser(AnfunSource.ROOT_URL,videoUrl)
)
}else{
PlayerInfo(
decodeType = PlayerInfo.DECODE_TYPE_HLS,
uri = SourceUtils.urlParser(AnfunSource.ROOT_URL,videoUrl)
)
}
}else{
throw ParserException("Unknown")
}
}
}

private fun detailed(document: Document, summary: CartoonSummary): Cartoon {
Log.e("TAG","------->>>>>>>detailed")

var desc = ""
var update = 0
var status = 0

val cover = document.select(".hl-dc-pic").select("span").attr("data-original")
val title = document.select(".hl-dc-headwrap").select(".hl-dc-title").text()
//document.select(".hl-dc-headwrap").select(".hl-dc-sub").text()
// 更新状况
val upStateItems = document.select(".hl-dc-content")
.select(".hl-vod-data").select(".hl-full-box").select("ul").select("li")
for (upStateEm in upStateItems){
val t = upStateEm.text()
when{
t.contains("状态:") -> {
status =
if (t.startsWith("连载")) Cartoon.STATUS_ONGOING
else if (t.startsWith("")) Cartoon.STATUS_COMPLETED
else Cartoon.STATUS_UNKNOWN
val isTheater = title.contains("剧场版")
update =
if (isTheater) {
if (status == Cartoon.STATUS_COMPLETED) {
Cartoon.UPDATE_STRATEGY_NEVER
} else {
Cartoon.UPDATE_STRATEGY_ONLY_STRICT
}
} else {
if (status == Cartoon.STATUS_COMPLETED) {
Cartoon.UPDATE_STRATEGY_ONLY_STRICT
} else {
Cartoon.UPDATE_STRATEGY_ALWAYS
}
}
}
t.contains("简介:") -> desc = t
}
}

return CartoonImpl(
id = summary.id,
url = SourceUtils.urlParser(AnfunSource.ROOT_URL, "/anime/${summary.id}.html"),
source = summary.source,

title = title,
coverUrl = cover,

intro = "",
description = desc,

genre = "",

status = status,
updateStrategy = update,
)
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.heyanle.easybangumi_extension.anfun

import com.heyanle.easybangumi4.source_api.component.ComponentWrapper
import com.heyanle.easybangumi4.source_api.entity.CartoonCover
import com.heyanle.easybangumi4.source_api.entity.CartoonCoverImpl
import com.heyanle.easybangumi4.source_api.utils.api.OkhttpHelper
import com.heyanle.easybangumi4.source_api.utils.core.SourceUtils
import org.jsoup.select.Elements

/**
* Created by heyanle on 2024/1/28.
* https://github.com/heyanLE
*/
class AnfunListComponent(
private val okhttpHelper: OkhttpHelper,
) : ComponentWrapper() {

companion object {
const val ROOT_URL = "https://www.anfuns.cc"
}

suspend fun listPage(
element: Elements,
): Pair<Int?, List<CartoonCover>> {
val r = arrayListOf<CartoonCover>()
for (video in element) {
video.apply {
val name = select("a").attr("title")
val videoUrl = select("a").attr("href")
val coverUrl = select("a").attr("data-original")
val episode = select(".remarks").text()
val id = videoUrl.subSequence(7, videoUrl.length - 5).toString()
if (!name.isNullOrBlank() && !videoUrl.isNullOrBlank() && !coverUrl.isNullOrBlank()) {
val b = CartoonCoverImpl(
id = id,
source = source.key,
url = videoUrl,
title = name,
intro = episode ?: "",
coverUrl = SourceUtils.urlParser(ROOT_URL, coverUrl)
)
r.add(b)
}
}
}
return Pair(null, r)
}

}
Loading

0 comments on commit c3f142a

Please sign in to comment.