Jun 29, 2012 06:16 AM
(This post was last modified: Jun 29, 2012 06:17 AM by nathan72389.)
I was writing this irc bot and wanted to give it a mean personality. after doing a bit of googling i found a site that listed alot of "bad words" but the problem was that they had it all separated through different pages. Rather than just copying and pasting everything into notepad and then removing dead lines and useless text, i decided to make this little app and just have it do all the work for me.
[img]http://i.minus.com/irzNS13thlSPc.png[/img]
all i needed the app to do was get the bad words and then print them to a file, one word per line. easy.
here is the code incase anyone wants to use any of it.
all of the code should be pretty easy to understand.
so, there ya have it, if you have any questions, feel free to ask.
[img]http://i.minus.com/irzNS13thlSPc.png[/img]
all i needed the app to do was get the bad words and then print them to a file, one word per line. easy.
here is the code incase anyone wants to use any of it.
Code
Imports System.Net
Imports System.IO
Imports System.Text.RegularExpressions
Module Module1
Sub Main()
Dim count As Integer
Dim Source As String
Dim Wc As New WebClient
Dim dir As String = Process.GetCurrentProcess.MainModule.FileName
dir = dir.Remove(dir.LastIndexOf("\") + 1, (dir.Length - dir.LastIndexOf("\") - 1))
If File.Exists(dir & "output.txt") Then File.Delete(dir & "output.txt")
For i As Integer = 65 To 90
Source = Wc.DownloadString("http://www.noswearing.com/dictionary/" & Chr(i))
For Each line As Match In MatchAll(Source, "valign=top>", "\n")
For Each badword As Match In MatchAll(line.Value, "name=" & Chr(34), Chr(34))
Console.WriteLine(badword.Value)
File.AppendAllText(dir & "output.txt", badword.Value & vbCrLf)
count += 1
Next
Next
Next
Console.WriteLine(count & " words added.")
Console.WriteLine("Press Enter to continue...")
Console.ReadLine()
End Sub
Function MatchAll(ByVal SourceString As String, ByVal strStart As String, ByVal strEnd As String) As MatchCollection
Return Regex.Matches(SourceString, "(?<=" & strStart & ").*?(?=" & strEnd & ")")
End Function
End Moduleall of the code should be pretty easy to understand.
so, there ya have it, if you have any questions, feel free to ask.





![[Image: 1zL3pDG.jpg]](https://i.imgur.com/1zL3pDG.jpg)