Skip to content

Commit

Permalink
add channel
Browse files Browse the repository at this point in the history
  • Loading branch information
lizongying committed May 17, 2024
1 parent 8a2a4ee commit 59904d6
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 113 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 更新日志

### v1.0.4

* 增加频道

### v1.0.3

* 增加频道
Expand Down
153 changes: 141 additions & 12 deletions app/src/main/java/com/lizongying/mytv1/WebFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class WebFragment : Fragment() {
webView.layoutParams.height = application.shouldHeightPx()

webView.settings.javaScriptEnabled = true
// webView.settings.domStorageEnabled = true
webView.settings.domStorageEnabled = true
webView.settings.databaseEnabled = true
webView.settings.javaScriptCanOpenWindowsAutomatically = true
webView.settings.mediaPlaybackRequiresUserGesture = false
Expand Down Expand Up @@ -85,10 +85,10 @@ class WebFragment : Fragment() {

override fun onConsoleMessage(consoleMessage: ConsoleMessage?): Boolean {
if (consoleMessage != null) {
Log.e(
"WebViewConsole",
"Message: ${consoleMessage.message()}, Source: ${consoleMessage.sourceId()}, Line: ${consoleMessage.lineNumber()}"
)
// Log.e(
// "WebViewConsole",
// "Message: ${consoleMessage.message()}, Source: ${consoleMessage.sourceId()}, Line: ${consoleMessage.lineNumber()}"
// )

if (consoleMessage.message() == "success") {
Log.e(TAG, "success")
Expand Down Expand Up @@ -139,7 +139,7 @@ class WebFragment : Fragment() {
val uri = Uri.parse(url)
Log.e(TAG, "uri ${uri.host}")
when (uri.host) {
"tv.cctv.com" -> webView.evaluateJavascript(context.resources.openRawResource(R.raw.cctv)
"tv.cctv.com" -> webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Expand All @@ -148,7 +148,7 @@ class WebFragment : Fragment() {
}

"www.gdtv.cn" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.gdtv)
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Expand All @@ -158,7 +158,7 @@ class WebFragment : Fragment() {
}

"www.setv.sh.cn" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.setv)
webView.evaluateJavascript(context.resources.openRawResource(R.raw.gdtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Expand All @@ -168,7 +168,7 @@ class WebFragment : Fragment() {
}

"live.kankanews.com" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.setv)
webView.evaluateJavascript(context.resources.openRawResource(R.raw.gdtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Expand All @@ -188,16 +188,144 @@ class WebFragment : Fragment() {
}

"www.sztv.com.cn" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.sztv)
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}

"news.hbtv.com.cn" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.hbtv)
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}
// "www.ahtv.cn" -> {
// webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
// .bufferedReader()
// .use { it.readText() }) { value ->
// if (value == "success") {
// Log.e(TAG, "success")
// }
// }
// }
"www.nxtv.com.cn" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}

"tv.gxtv.cn" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}

"live.fjtv.net" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}

"tc.hnntv.cn" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}

"www.hebtv.com" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}

"live.mgtv.com" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}

"www.hnntv.cn" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}

"news.hbtv.com.cn" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}

"www.jxntv.cn" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}

"www.gzstv.com" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}

"www.cztv.com" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Log.e(TAG, "success")
}
}
}
"www.jlntv.cn" -> {
webView.evaluateJavascript(context.resources.openRawResource(R.raw.ahtv)
.bufferedReader()
.use { it.readText() }) { value ->
if (value == "success") {
Expand All @@ -217,7 +345,7 @@ class WebFragment : Fragment() {
// }

this.tvModel = tvModel
val url = tvModel.videoUrl.value as String
var url = tvModel.videoUrl.value as String
Log.i(TAG, "play ${tvModel.tv.title} $url")
val uri = Uri.parse(url)
Log.e(TAG, "uri ${uri.host}")
Expand All @@ -235,6 +363,7 @@ class WebFragment : Fragment() {
"www.yangshipin.cn" -> {
}
}
// url = "https://news.hbtv.com.cn/app/tv/434"
webView.loadUrl(url)
}

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/src/main/res/raw/channels.txt

Large diffs are not rendered by default.

32 changes: 0 additions & 32 deletions app/src/main/res/raw/hbtv.js

This file was deleted.

36 changes: 0 additions & 36 deletions app/src/main/res/raw/setv.js

This file was deleted.

32 changes: 0 additions & 32 deletions app/src/main/res/raw/sztv.js

This file was deleted.

0 comments on commit 59904d6

Please sign in to comment.