如何search整个网站的关键字

我想知道整个网站是否存在某个关键字。

我该怎么做?

用这种方式快速提示用户

“使用Googlesearch101)

只需input您的search字词,然后点击网站:www.website.com

但是我不确定如何testing它是正面的还是负面的。

谁能帮忙?

尝试这个,它基本上检查是否有任何谷歌search结果通过search网站上的关键字或短语:

Sub Check_Website() Dim ie As Object Dim str As String, web As String, URL As String Dim iResults As Integer 'Create IE object Set ie = CreateObject("InternetExplorer.Application") 'Set string to search for str = "hello" str = Replace(str, " ", "+") 'Set website to search in web = "www.google.com" 'Create full URL URL = "https://www.google.co.uk/search?q=" & str & "+site%3A" & web 'Navigate to URL With ie .Visible = False .Navigate URL Do While .ReadyState <> 4: DoEvents: Loop End With 'Count results on first page iResults = ie.Document.getelementsbyclassname("g").Length 'Message box dependent on results If iResults = 0 Then MsgBox "No matches were found." Else MsgBox "Matches found." End If ie.Quit Set ie = Nothing End Sub 

Google使用类别名称“g”作为search结果,意味着特定search结果页面的“g”类中最多有10个项目,如果没有显示结果,则不存在“g”类别,这意味着没有项目要计算。

也是这样的

 Function FIND_IN_PAGE(strURL As String, strSearch As String) Dim pos As Long Dim ie As SHDocVw.InternetExplorer Dim doc As MSHTML.HTMLDocument Set ie = New SHDocVw.InternetExplorer ie.Visible = 1 ie.navigate strURL Do Until ie.readyState = READYSTATE_COMPLETE And ie.Busy = False DoEvents Loop Set doc = ie.document.DocumentElement pos = InStr(1, doc.innerText, strSearch) FIND_IN_PAGE = pos ie.Quit Set ie = Nothing Set doc = Nothing End Function 

像这样调用

FIND_IN_PAGE("http://stackoverflow.com/questions/40848321/how-to-search-for-a-keyword-in-entire-website","entire")