@@ -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 {
0 commit comments