todo: openrec 重构
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/474420502/extractor"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
@@ -23,6 +24,12 @@ type OpenrecExtractor struct {
|
||||
supporters *intimate.ExtractorSource
|
||||
}
|
||||
|
||||
type UserInfo struct {
|
||||
UserName string `exp:"//p[ contains(@class, 'c-global__user__profile__list__name__text')]"`
|
||||
Followers int `exp:"//p[@class='c-global__user__count__row__right js-userCountFollowers']" mth:"r:ParseNumber"`
|
||||
Views int `exp:"//ul[@class='c-contents']//p[@class='c-thumbnailVideo__footer__liveCount']" mth:"r:ExtractNumber"`
|
||||
}
|
||||
|
||||
func (oe *OpenrecExtractor) Execute() {
|
||||
|
||||
ps := intimate.NewPerfectShutdown()
|
||||
@@ -55,6 +62,9 @@ func (oe *OpenrecExtractor) Execute() {
|
||||
oe.user = intimate.NewExtractorSource(&htmlUser)
|
||||
oe.user.CreateExtractor()
|
||||
|
||||
userEtor := extractor.ExtractHtmlString(htmlUser.String())
|
||||
log.Println(userEtor.GetObjectByTag(UserInfo{}))
|
||||
|
||||
htmlLive := datamap["html_live"]
|
||||
oe.userLive = intimate.NewExtractorSource(&htmlLive)
|
||||
oe.userLive.CreateExtractor()
|
||||
|
||||
@@ -38,7 +38,7 @@ func main() {
|
||||
|
||||
streamer, err := estore.Pop(intimate.Ptwitcasting)
|
||||
if err != nil {
|
||||
log.Println(err, streamer.UserId)
|
||||
log.Println(err, streamer)
|
||||
}
|
||||
|
||||
streamer.LiveUrl = sql.NullString{String: "https://twitcasting.tv/" + streamer.UserId, Valid: true}
|
||||
@@ -93,7 +93,7 @@ func main() {
|
||||
streamer.Platform = intimate.Ptwitcasting
|
||||
streamer.UpdateTime = sql.NullTime{Time: time.Now(), Valid: true}
|
||||
streamer.UserName = sql.NullString{String: ldata.UserName, Valid: true}
|
||||
streamer.Operator = 10
|
||||
streamer.Operator = 0
|
||||
// streamer.UpdateInterval = 60
|
||||
clog := &intimate.CollectLog{}
|
||||
clog.UserId = streamer.UserId
|
||||
|
||||
Reference in New Issue
Block a user