2016-11-02 149 views
-2

我一直在試圖從網站抓取一個號碼,然後實時更新號碼。我沒有成功。從網站抓取一個號碼

#include <GUIConstantsEx.au3> 
#include <StaticConstants.au3> 
#include <WindowsConstants.au3> 
#Region ### START Koda GUI section ### Form= 
$Form1 = GUICreate("Form1", 290, 113, 633, 260) 
$Subscribercount = GUICtrlCreateLabel("0", 64, 56, 15, 29) 
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") 
$text = GUICtrlCreateLabel("PewDiePie Subscriber Count", 80, 24, 140, 17) 
GUISetState(@SW_SHOW) 
#EndRegion ### END Koda GUI section ### 

While 1 
    $nMsg = GUIGetMsg() 
    Switch $nMsg 
     Case $GUI_EVENT_CLOSE 
      Exit 

    EndSwitch 
WEnd 

我們可以得到這個網站的用戶人數:https://livecounts.net/channel/pewdiepie

現在,任何人都可以請幫助我?我會真的appriciate它!

回答

0

爲什麼不從YouTube獲得用戶數?這應該讓你開始。

#include <String.au3> 
#include <GUIConstantsEx.au3> 
#include <WindowsConstants.au3> 
HotKeySet("{ESC}", "quit") 

GUICreate("PewDiePie Subscriber Count", 300, 50, -1, -1) 
$data = GUICtrlCreateLabel("", 10, 10, 380, 50) 
GUICtrlSetFont(-1, 18, 575, 0, "MS Sans Serif") 
GUICtrlSetColor(-1, 0xFF0000) 
GUISetState() 

While 1 
    Sleep(2000) 
    gethits() 
WEnd 

Func gethits() 
    $Source = BinaryToString(InetRead('https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw', 1)) 
    $hits = _StringBetween($Source, 'subscribed yt-uix-tooltip" title="', '" tabindex="') 
    For $a In $hits 
     GUICtrlSetData($data, $a) 
    Next 
EndFunc ;==>gethits 

Func quit() 
    Exit 
EndFunc ;==>quit