Skip to content

Commit 9ac8e62

Browse files
committed
修改为联通配置,测试
1 parent fa09ca2 commit 9ac8e62

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

internal/app/iptv/hwctc/authenticator.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,18 @@ func (c *Client) authLoginHWCTC(ctx context.Context, referer string) (string, er
113113

114114
// 解析响应内容
115115
result, err := io.ReadAll(resp.Body)
116+
c.logger.Info(string(result))
116117
if err != nil {
117118
return "", err
118119
}
119120
regex := regexp.MustCompile("EncryptToken = \"(.+?)\";")
120121
matches := regex.FindSubmatch(result)
122+
c.logger.Info(string(matches[0]))
123+
c.logger.Info(string(matches[1]))
121124
if len(matches) != 2 {
122125
return "", errors.New("failed to parse EncryptToken")
123126
}
124-
return string(matches[1]), nil
127+
return string(matches[0]), nil
125128
}
126129

127130
// validAuthenticationHWCTC 认证第三步,获取UserToken和cookie中的JSESSIONID
@@ -144,7 +147,7 @@ func (c *Client) validAuthenticationHWCTC(ctx context.Context, encryptToken stri
144147
}
145148

146149
// 输入的格式:random + "$" + EncryptToken + "$" + UserID + "$" + STBID + "$" + IP + "$" + MAC + "$" + Reserved + "$" + CTC
147-
input := fmt.Sprintf("%d$%s$%s$%s$%s$%s$$CTC",
150+
input := fmt.Sprintf("%d$%s$%s$%s$%s$%s$$CU",
148151
random, encryptToken, c.config.UserID, c.config.STBID, ipv4Addr, c.config.MAC)
149152
// 使用3DES加密生成Authenticator
150153
crypto := iptv.NewTripleDESCrypto(c.key)
@@ -219,6 +222,10 @@ func (c *Client) validAuthenticationHWCTC(ctx context.Context, encryptToken stri
219222
}
220223
}
221224

225+
if jsessionID == "" {
226+
return nil, errors.New("failed to find JSESSIONID in response")
227+
}
228+
222229
// 解析响应内容
223230
result, err := io.ReadAll(resp.Body)
224231
if err != nil {

internal/app/iptv/hwctc/channel.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func (c *Client) GetAllChannelList(ctx context.Context) ([]iptv.Channel, error)
6969

7070
// 解析响应内容
7171
result, err := io.ReadAll(resp.Body)
72+
c.logger.Info(string(result))
7273
if err != nil {
7374
return nil, err
7475
}

0 commit comments

Comments
 (0)