Alright Quick question for any VBS/Javascript coders out there. Basically I am making a script that scans a website for a phrase in plain text then tell me if it is there; However, I need it to change part of the URL if it doesn't find anything, and then
reload the page and search again. Basically like
"http://www.youtube.com/watch=?55555"
it would search for say the word "bunnies". if it doesnt find the word on there then it adds one to the "55555" to make it "55556" and then searches that page, so on and so on.
Here is what i have so far.
"http://www.youtube.com/watch=?55555"
it would search for say the word "bunnies". if it doesnt find the word on there then it adds one to the "55555" to make it "55556" and then searches that page, so on and so on.
Here is what i have so far.
url = "www.example.com/55555"
phrase = "Bunnies"
'load the page specified by the variable "url"
Set req = CreateObject("Msxml2.XMLHTTP.6.0")
req.open "GET", url, False
req.send
If req.status = 200 Then
'if the page was successfully loaded, write the HTML to an HTMLFile object,
'which will allow to retrieve the plain text (without HTML tags) from it
Set html = CreateObject("HTMLFile")
html.Write req.responseText
If InStr(html.body.innerText, phrase) > 0 Then
'if the plain text contains the phrase do this
WScript.Echo "Phrase found."
Else
'if the plain text doesn't contain the phrase do something else
WScript.Echo "Phrase not found."
End If
Else
'if the page couldn't be loaded, show a message with status information
WScript.Echo "Cannot load " & url & ": [" & req.status & "] " & req.statusText
End If
So Basically all i need that to do is loop continuously until it finds "Bunnies" on the page. I also need to make sure it stops at a reasonable number so that it doesnt crash my pc lol. I would also appreciate if it tells me what URL it found it on.