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()
|
||||
|
||||
Reference in New Issue
Block a user