从网站上获取一个数字

时间:2016-11-02 17:38:44

标签: numbers autoit

我一直试图从网站上获取一个数字,然后实时更新该数字。我还没有成功。

#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

现在,有人可以帮我这个吗?我真的很喜欢它!

1 个答案:

答案 0 :(得分: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