Skip to content

Commit

Permalink
fix ysp
Browse files Browse the repository at this point in the history
  • Loading branch information
lizongying committed Feb 6, 2024
1 parent 8137515 commit aa4d526
Show file tree
Hide file tree
Showing 6 changed files with 962 additions and 77 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/lizongying/mytv/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
val content = binding.content

var idx: Long = 0
context?.let { TVList.init(it) }
for ((k, v) in TVList.list) {
val itemBinding: RowBinding =
RowBinding.inflate(layoutInflater, content, false)
Expand Down
37 changes: 15 additions & 22 deletions app/src/main/java/com/lizongying/mytv/Request.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Request {

private val regex = Regex("""des_key = "([^"]+).+var des_iv = "([^"]+)""")
private val input =
"""{"mver":"1","subver":"1.2","host":"www.yangshipin.cn/#/tv/home?pid=","referer":"","canvas":"YSPANGLE(Apple,AppleM1Pro,OpenGL4.1)"}""".toByteArray()
"""{"mver":"1","subver":"1.2","host":"www.yangshipin.cn/#/tv/home?pid=","referer":"","canvas":"YSPANGLE(Apple,ANGLEMetalRenderer:AppleM1Pro,UnspecifiedVersion)"}""".toByteArray()

private var mapping = mapOf(
"CCTV4K" to "CCTV4K 超高清",
Expand Down Expand Up @@ -118,6 +118,7 @@ class Request {
override fun onResponse(call: Call<LiveInfo>, response: Response<LiveInfo>) {
if (response.isSuccessful) {
val liveInfo = response.body()

if (liveInfo?.data?.playurl != null) {
val chanll = liveInfo.data.chanll
val decodedBytes = Base64.decode(
Expand All @@ -133,8 +134,8 @@ class Request {
val url = liveInfo.data.playurl + "&revoi=" + encryptTripleDES(
keyBytes + byteArrayOf(0, 0, 0, 0, 0, 0, 0, 0),
ivBytes
).uppercase()
// Log.d(TAG, "$title url $url")
).uppercase() + liveInfo.data.extended_param
Log.d(TAG, "$title url $url")
tvModel.addVideoUrl(url)
tvModel.allReady()
tvModel.retryTimes = 0
Expand Down Expand Up @@ -202,7 +203,7 @@ class Request {
}

override fun onFailure(call: Call<LiveInfo>, t: Throwable) {
Log.e(TAG, "$title request error")
Log.e(TAG, "$title request error $t")
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
tvModel.retryTimes++
if (tvModel.getTV().needToken) {
Expand Down Expand Up @@ -354,29 +355,21 @@ class Request {
) {
if (response.isSuccessful) {
val body = response.body()

if (body?.data?.feedModuleListCount == 1) {
for (item in body.data?.feedModuleListList!![0]?.dataTvChannelListList!!) {
if (item.isVip && !item.isLimitedFree) {
continue
}
Log.i(
Log.d(
TAG,
"${item.channelName},${item.pid},${item.streamId}"
)
var channelType = "央视频道"
if (item?.channelType === "weishi") {
channelType = "地方频道"
}
if (!mapping.containsKey(item.channelName)) {
continue
}
val tv =
TVList.list[channelType]?.find { it.title == mapping[item.channelName] }
if (tv != null) {
tv.logo = item.tvLogo
tv.pid = item.pid
tv.sid = item.streamId

for ((_, v) in TVList.list) {
for (v2 in v) {
Log.i(TAG, "$v2")
if (v2.title == item.channelName || v2.alias == item.channelName) {
v2.pid = item.pid
v2.sid = item.streamId
}
}
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/lizongying/mytv/TV.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import java.io.Serializable
data class TV(
var id: Int = 0,
var title: String,
var alias: String = "",
var videoUrl: List<String>,
var videoIndex: Int = 0,
var channel: String = "",
var logo: String = "",
var pid: String = "",
var sid: String = "",
var programId: String = "",
var needToken:Boolean=false,
var mustToken:Boolean=false,
var needToken: Boolean = false,
var mustToken: Boolean = false,

) : Serializable {
) : Serializable {

override fun toString(): String {
return "TV{" +
Expand Down
Loading

0 comments on commit aa4d526

Please sign in to comment.