diff --git a/crx/myblock.crx b/crx/myblock.crx index 6ee88c6..f4d1096 100644 Binary files a/crx/myblock.crx and b/crx/myblock.crx differ diff --git a/crx/myblock.pem b/crx/myblock.pem index 605b6cf..1583eff 100644 --- a/crx/myblock.pem +++ b/crx/myblock.pem @@ -1,28 +1,28 @@ -----BEGIN PRIVATE KEY----- -MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDSG09DSvB03TOe -eOmQwfiCIf0wa2WRB31ewxa6i/PRgEKeJSUvIsIuaECUer2ss+J3rwSS2lDpGuiw -FnsVyZqKI/+Rcuc83YJGYg6OAzVMz6UL8YCWhXu3huTJ+V+a5iNereIC69ZERRJt -nXlWqsq6HKya+6BP9sX9CI4GTHQrnWBysAxsswhdnnnRvu+GxglWafSIzuS6OizT -1M1CmkZxNvDJhTSOR7SJlIYm2kM5/fIL53BdndF2IGAjfV1WV7AjwhTfun5cViEO -i8niQUIMY4L0AiO9grFD1g1xIYkeuVBoLxOUBzPxJwQmb64gseb9Dvt0BKLRGoou -SIOyE+KVAgMBAAECggEAI4b6J2kR0VUBEDwmVHO0K38HUstqNHSVgrNO0dLt8sAz -I44o5DhGqPW4a9L4ZS5SrkWyKonPcic6buISRIwfPVoacjQBfVWAXJnil6lbtyYK -ZMNcqLcgBRfCcpOgEq91DiKta6yIwekDFXVyCdFd78v+9ML1J+hUsLVkXJTLdP88 -PGamRWVd6vGy3QMRjyM29GLPgS+/6Vrp1cptSuYNqYhlszohmu8lBvzjH9jbPh9d -GFrrd8Bs7IRCdtKZig/3fbln4JEyyOYE+gcT2jplPksB6mR/5DBIdkVbeuFwGB0+ -h1/PKlprNQt7+Ei0HhHnTib7lZP8WGo4HkSi7PsAGQKBgQD1Ptho0wJiI2+6gL1O -iNsEJVKIQ2Sxdx3wI/qudphM99t6xKCpPyVI2Nd9PBf2jbZjGAaz+P/KQYxEqb6i -PRcQ+i99wCQoRfnRvUbKA4goEpKwRXmvn+499dm6D5pEuumOXGQY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LLRncRJcofU581W2X5sksagMZxzrnghP/sy6etgJzAbZCW+nA +nQga1RQ+altqRGlC2VUNcUliE5/z0cznfM+Oi6cBAoGBAK68wjkperl8+ARQrqII +Zg41PVrsFv6XmuLWv3bqnsx81BTbnHdqmPT4pScPLZvj+6c3iX8D8wzhzbgZtS0I +h+r1yMEdzyRZMGtvdi/f/+1TuhOTr/ZeoqYHWEduo8iRYLQBN9gGEkkKBQ4d14zi +8elaha7vrG/teCrFoeFcXIPr -----END PRIVATE KEY----- diff --git a/extractor/nimo_extractor/nimo_extractor.go b/extractor/nimo_extractor/nimo_extractor.go new file mode 100644 index 0000000..375cf4c --- /dev/null +++ b/extractor/nimo_extractor/nimo_extractor.go @@ -0,0 +1,9 @@ +package main + +import "intimate" + +// sstore 源存储实例, 为存储源数据的实现. 表格具体参考sql/intimate_source.sql +var sstore *intimate.StoreSource = intimate.NewStoreSource(string(intimate.STNimo)) + +// estore 解析存储连接实例 +var estore *intimate.StoreExtractor = intimate.NewStoreExtractor() diff --git a/extractor/nimo_extractor/nimo_extractor_test.go b/extractor/nimo_extractor/nimo_extractor_test.go new file mode 100644 index 0000000..61bc2fb --- /dev/null +++ b/extractor/nimo_extractor/nimo_extractor_test.go @@ -0,0 +1,88 @@ +package main + +import ( + "intimate" + "log" + "testing" + "time" + + "github.com/474420502/extractor" + "github.com/tebeka/selenium" +) + +func TestMain(t *testing.T) { + Execute() +} + +type WaitFor struct { + WebDriver selenium.WebDriver +} + +func NewWaitFor(wd selenium.WebDriver) *WaitFor { + return &WaitFor{WebDriver: wd} +} + +func (wf *WaitFor) Default(xpath string, do func(elements ...selenium.WebElement) bool) error { + return wf.WebDriver.WaitWithTimeout(func(wd selenium.WebDriver) (bool, error) { + elements, err := wd.FindElements(selenium.ByXPATH, xpath) + if err != nil { + log.Println(err) + return false, err + } + + if len(elements) > 0 { + if do == nil { + return true, nil + } + if do(elements...) { + return true, nil + } + } + return false, nil + + }, time.Second*15) +} + +type LiveInfo struct { + Followers int64 `exp:"//div[contains(@class,'nimo-rm_followers')]//span[@class='text c2']" mth:"r:ExtractNumber"` + Views int64 `exp:"//div[contains(@class,'nimo-rm_audience')]//span[@class='text c2']" mth:"r:ExtractNumber"` + Giver []int64 `exp:"//div[contains(@class,'rank-item-after3')]//span[contains(@class,'nimo-currency__count')]"` +} + +func Execute() { + wd := intimate.GetChromeDriver(3031) + waitfor := NewWaitFor(wd) + ps := intimate.NewPerfectShutdown() + + for !ps.IsClose() { + // streamer, err := estore.Pop(intimate.PNimo) + // if err != nil { + // log.Println(err) + // // estore.UpdateError(streamer, err) + // continue + // } + // log.Println(streamer) + var pagesource string + // wd.Get(streamer.LiveUrl.String) + wd.Get("https://www.nimo.tv/live/1253835677") + + waitfor.Default("//div[contains(@class,'nimo-rm_followers')]//span[@class='text c2' and text() != '']", nil) + waitfor.Default("//div[contains(@class,'rank-item-top3')]", nil) + element, err := wd.FindElement(selenium.ByXPATH, "//div[contains(@class,'rank-item-top3')]") + if err != nil { + log.Println(err) + } else { + err = element.MoveTo(50, 50) + element.Click() + if err != nil { + log.Println(err) + } + } + + waitfor.Default("//div[contains(@class,'nimo-rm_audience')]//span[@class='text c2']", nil) + pagesource, _ = wd.PageSource() + etor := extractor.ExtractHtmlString(pagesource) + li := etor.GetObjectByTag(LiveInfo{}).(*LiveInfo) + log.Printf("%#v", li) + } +} diff --git a/extractor/twitch_extractor/tiwtch_extractor.go b/extractor/twitch_extractor/tiwtch_extractor.go index c6173ba..2ae0c23 100644 --- a/extractor/twitch_extractor/tiwtch_extractor.go +++ b/extractor/twitch_extractor/tiwtch_extractor.go @@ -29,7 +29,7 @@ func main() { // var err error for !ps.IsClose() { - streamer, err := estore.PopNoWait(intimate.Ptwitch, "tags is NULL", 15) + streamer, err := estore.Pop(intimate.Ptwitch) if streamer == nil || err != nil { if err != lasterr { log.Println(err, lasterr) diff --git a/store.go b/store.go index d49df1e..673bb81 100644 --- a/store.go +++ b/store.go @@ -228,6 +228,7 @@ func NewStoreExtractor() *StoreExtractor { return &StoreExtractor{db: db} } +// PopNoWait 弹出一个不用按时间间隔更新的主播信息, 主要用来测试. func (store *StoreExtractor) PopNoWait(platform Platform, condition string, operators ...int32) (*Streamer, error) { tx, err := store.db.Begin() if err != nil { diff --git a/supervisor_conf/nimo_task1.conf b/supervisor_conf/nimo_task1.conf new file mode 100644 index 0000000..778f858 --- /dev/null +++ b/supervisor_conf/nimo_task1.conf @@ -0,0 +1,13 @@ +[supervisord] +nodaemon=false + +[program:nimo_task1] +environment=DISPLAY=":99" +directory = MYPATH/bin/nimo_task1/ +command= MYPATH/bin/nimo_task1/nimo_task1 +# process_name=%(program_name)s_%(process_num)02d ;多进程名称 +# numprocs=1 ;启动多个进程 +autorestart=true +stderr_logfile=MYPATH/bin/nimo_task1/log +stderr_logfile_maxbytes=0 +stopsignal=QUIT diff --git a/tasks/nimo/nimo_task1/main.go b/tasks/nimo/nimo_task1/main.go new file mode 100644 index 0000000..736ef31 --- /dev/null +++ b/tasks/nimo/nimo_task1/main.go @@ -0,0 +1,5 @@ +package main + +func main() { + Execute() +} diff --git a/tasks/nimo/nimo_task1/nimo_task1.go b/tasks/nimo/nimo_task1/nimo_task1.go index d423e90..827e0bf 100644 --- a/tasks/nimo/nimo_task1/nimo_task1.go +++ b/tasks/nimo/nimo_task1/nimo_task1.go @@ -59,7 +59,7 @@ func Execute() { log.Println(tp.GetURLRawPath(), "rooms:", len(rooms)) if len(rooms) == 0 { param.IntSet(1) - time.Sleep(time.Minute * 10) + time.Sleep(time.Minute * 15) continue } diff --git a/testfile/nimolive.html b/testfile/nimolive.html new file mode 100644 index 0000000..b91e763 --- /dev/null +++ b/testfile/nimolive.html @@ -0,0 +1,2015 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Best Allain VN 直播-AOV 直播-遊戲直播在線觀看 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
+
+
+
+
+
+
+ + Best Allain VN + + +
+
+
+
+
+

kéo rank nha các + bạn iew

+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ + + Nimo TV + +
12
+
+

Best Allain VN

+ +
-
+
followers:211 +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
    +
  • 480P
  • +
  • 360P
  • +
+
480P
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

您的瀏覽器不支持視頻自動播放

點擊播放 +
+
+
+
+ + Nimo TV + + +
+
+
+ kéo rank nha các bạn iew
+
+
+
+
Best Allain VN
+
+ +
-
+
+ followers:211
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+ + + Nimo TV + +
+
+
+
+
+
+
+
+
+
+
+
+ + + 幸运草 + +
+
+
+
+ + + 咖啡 + +
+
+
+
+ + + 粉絲票 + +
+
+
+
+ + + 禮盒 + + + + Nimo TV + +
+
+
+
+ + + 彩蛋 + + + + Nimo TV + +
+
+
+
+ + + Carriage + + + + Nimo TV + +
+
+
+
+ + + 跑车 + + + + Nimo TV + +
+
+
+
+ + + 火箭 + + + + Nimo TV + +
+
+
+
+ + + Vietnam is the best + +
+
+
+
+ + + Romantic Skywheel + +
+
+
+
+ + + 丘比特 + +
+
+
+
+ + + 撒錢 + +
+
+
+
+ + + 旋轉木馬 + + + + Nimo TV + +
+
+
+
+ + + 摩托车 + +
+
+
+
+ + + 血瓶 + +
+
+
+
+ + + 炸彈 + +
+
+
+
+ + + 螢光棒 + +
+
+
+
+ + + 口罩 + +
+
+
+
+ + + 魔法書 + +
+
+
+
+
+
+
+
+
+
+
0 +
+
0 +
+
0 +
+
+
+
+
+
+
+
+
+
+
+ 貢獻榜
+
+ 貴賓席 (0)
+
+
粉絲榜
+
+
+
+
+
+ 我的王座還空著,快去收集禮物吧~
+
+
+
+
該主播未創建粉絲團
+
+
+
+
+
+
+
+
+
+
+
+ + 系統消息:Nimo官方提倡綠色直播,對直播內容進行24小時線上巡查。任何傳播違法、違規、低俗、暴力等不當訊息的行為將被停用帳號。請勿與他人私下交易轉帳,以免上當受騙。 +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
    + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
  • +
  • +
  • +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
    + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
  • +
  • +
  • +
+
+ +
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
    + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + +
  • + +
  • +
  • +
  • +
  • +
+
+ +
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + + +
+
+ +

+ 升級一下你的瀏覽器吧,使用體驗會很棒喲!

+
+
+
+
Chrome
+ 下載 +
+
+
+
Firefox
+ 下載 +
+
+
+
+ + + + + + + + + + + + + + + + + + + +
+
+ + + +
+
+
+
+
+ + + + + + \ No newline at end of file diff --git a/utils.go b/utils.go index 2ed1a79..c3b9ac1 100644 --- a/utils.go +++ b/utils.go @@ -87,9 +87,12 @@ func GetChromeDriver(port int) selenium.WebDriver { caps := selenium.Capabilities{"browserName": "chrome"} chromecaps := chrome.Capabilities{} + + // chromecaps.AddExtension("/home/eson/test/myblock.crx") for _, epath := range []string{"../../../crx/myblock.crx", "../../crx/myblock.crx"} { _, err := os.Stat(epath) if err == nil { + err := chromecaps.AddExtension(epath) if err != nil { panic(err)