Что нового

Парсер страниц

sense1

Новичок
Сообщения
4
Репутация
0
Привет. Столкнулся с проблемой, есть парсер ссылок с сайта по искомому значению,только он парсит первую страницу поиска,а нужно всё.

Как это прописать?

Код:
$form1 = GUICreate("Find in",150,150)
$find = GUICtrlCreateInput("Find",45,45,75)
$but = GUICtrlCreateButton("Find",52,84,60)
GUICtrlSetBkColor(-1, 0x0)
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)

While 1
	Switch GUIGetMsg()
		CASE $GUI_EVENT_CLOSE
			ExitLoop
		Case $but

$oIE = _IECreate($url,0,1,1,1)
_IELoadWait ($oIE)
$a = GUICtrlRead($find)
$oSubmit = _IEGetObjById($oIE, "search-btn")
$oSet = _IEGetObjById($oIE, "masthead-search-term")
_IEFormElementSetValue ($oSet,$a)
_IEAction($oSubmit, "click")


Sleep(1000)

$oLinks = $oIE.document.getElementsByClassName('yt-uix-sessionlink spf-link')

Local $file = FileOpen($f,1)
For $oLink in $oLinks
	If StringInStr($oLink.href,"watch") And  Not StringInStr($oLink.href,"list") Then

    FileWrite($f,$oLink.href & @CRLF)
	EndIf
Next
FileClose($file)

$sFileName = $f
$sFilePath = @ScriptDir & "\"
$sFile = $sFilePath & $sFileName

$iRet = _FileDeleteDuplicateLines($sFile, 0)
$iExtended = @extended

If $iRet = 1 And $iExtended > 0 Then
    MsgBox(64, "Results", StringFormat("Find in file <%s> mount of doubles: %i", $sFileName, $iExtended))
ElseIf $iExtended = 0 Then
    MsgBox(64, "Results", StringFormat("In file <%s> no doubles", $sFileName))
ElseIf @error = 1 Then
    MsgBox(48, "Results", StringFormat("File<%s> not found ", $sFileName))
ElseIf @error = 2 Then
    MsgBox(48, "Results", StringFormat("Error", $sFileName))
EndIf

    ExitLoop
	EndSwitch
	WEnd
 
Верх