Skip to content

Commit

Permalink
自动保存channel.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHan1233 committed Jan 31, 2025
1 parent 7febdbf commit 6a014f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 0 additions & 5 deletions internal/app/iptv/hwctc/authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,10 @@ func (c *Client) validAuthenticationHWCTC(ctx context.Context, encryptToken stri
if err != nil {
return nil, err
}
c.logger.Info(string(result))

// 匹配UserToken
regex := regexp.MustCompile(`"UserToken" value="(.+?)"`)
matches := regex.FindSubmatch(result)
c.logger.Info(fmt.Sprintf("matches: %d", len(matches)))
for i := range matches {
c.logger.Info("matches " + strconv.Itoa(i) + ": " + string(matches[i]))
}
if len(matches) != 2 {
return nil, errors.New("failed to parse userToken")
}
Expand Down
3 changes: 2 additions & 1 deletion internal/app/iptv/hwctc/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ func (c *Client) GetAllChannelList(ctx context.Context) ([]iptv.Channel, error)
if err != nil {
return nil, err
}
chRegex := regexp.MustCompile("ChannelID=\"(.+?)\",ChannelName=\"(.+?)\",UserChannelID=\"(.+?)\",ChannelURL=\"(.+?)\",TimeShift=\"(.+?)\",TimeShiftLength=\"(\\d+?)\".+?,ChannelSDP=\"(.+?)\",TimeShiftURL=\"(.+?)\"")
chRegex := regexp.MustCompile("ChannelID=\"(.+?)\",ChannelName=\"(.+?)\",UserChannelID=\"(.+?)\",ChannelURL=\"(.+?)\",TimeShift=\"(.+?)\",TimeShiftLength=\"(\\d+?)\".+?,TimeShiftURL=\"(.+?)\"")
matchesList := chRegex.FindAllSubmatch(result, -1)
c.logger.Info("matchesList cnt: " + strconv.Itoa(len(matchesList)))
if matchesList == nil {
return nil, fmt.Errorf("failed to extract channel list")
}
Expand Down

0 comments on commit 6a014f2

Please sign in to comment.