我正在创建一个程序来使用 VB.NET 检测抄袭文章。在我创建的程序中,我使用 google 作为工具来检测它。例如有一篇文章是这样的:
计算机是当今非常流行的技术之一
所以我使用的算法是,我通过使用前两个引号和句子的结尾将句子输入到谷歌搜索中。所以我会用这样的关键字在谷歌上搜索。“计算机是当今相当流行的技术之一” 如果搜索google,发现有一个网站使用了这句话,可以确定该文章是抄袭的。
但是,我的程序必须检查数百篇文章。所以它会在短时间内自动打开google,搜索很多关键词。我创建的程序使用 webbrowser 打开了 google。
显然,因为程序我必须检查数百篇文章,然后网络浏览器逐渐引发这样的错误:
因为我确实正在制作一个用于在 google 上搜索的机器人。
那么,有什么建议可以克服/克服这个问题吗?
这是我的代码:(对不起,对我的代码的评论是印度尼西亚语)
Dim totallink As String = ""
tempcek = tempstrline.Substring(start, selesai - start)
'cek di google
WebBrowser1.Navigate("https://www.google.co.id/search?q=%22" & tempcek & "%22")
'proses menunggu webbrowser loading
Dim sw As New Stopwatch
sw.Start()
Do Until sw.Elapsed.Seconds = 5
Application.DoEvents()
Loop
sw.Stop()
sw.Reset()
'------
'cek pada source code browser
'pattern : </a></h3><div class="s">
'pattern2 : href="
Dim pattern As String = "</a></h3><div class=" & Chr(34) & "s" & Chr(34) & ">"
Dim pattern2 As String = "href=" & Chr(34)
If WebBrowser1.Document.Body.InnerHtml.Contains(pattern) And Not WebBrowser1.Document.Body.InnerHtml.ToLower.Contains("tidak ditemukan") Then
Dim tempsc As String = WebBrowser1.Document.Body.InnerHtml
'mendapatkan semua link yang ada di pencarian google
While tempsc.IndexOf(pattern) > -1
tempsc = tempsc.Substring(tempsc.IndexOf(pattern) - 300)
Dim templink As String = tempsc.Substring(tempsc.IndexOf(pattern2) + 6)
templink = templink.Substring(0, templink.IndexOf(Chr(34)))
tempsc = tempsc.Substring(350)
webbrowser.contains(pattern) diatas
totallink &= templink & "."
hasil(idxhasil) = totallink & ";" & i & "," & tempcek
End While
Else
'cek selanjutnya dengan kondisi sudah mentok string yang plagiasi
idxhasil += 1
start = tempstrline.IndexOf(" ", selesai) + 1
hitungspasike4(selesai, tempstrline)
End If
'cek selanjutnya dengan kondisi string masih bisa dikembangkan lagi untuk dicek plagiasinya
selesai = tempstrline.IndexOf(" ", selesai + 1)