Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

(vb.net source) Extracting all bad words from "noswearing.com"

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.

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 Module

all of the code should be pretty easy to understand.

so, there ya have it, if you have any questions, feel free to ask.
uuuhm.

Code
dir = dir.Remove(dir.LastIndexOf("\") + 1, (dir.Length - dir.LastIndexOf("\") - 1))

Code
dir = Path.GetPathRoot(dir)

A bit cleaner?;x

[Image: HJdK32K_x]
lensert.com is the new screenshot utility, try it out now!
OSX & WINDOWS

lool rofl rifk n00b h3h3 t3st som3thing :P
Don't really see the point of this but good luck...
Hi,guys

i have button 'to remove bad words from listbox
textbox to find words i want and listbox.

Can you tell me how to do that in listbox and save it to txt good words without savefiledialog popup ?

I have loaded 200 urls in listbox and i want to remove useless words from listbox and save them to desktop but only good.

I need full Example of code:

Code
if <words> <are bads of urls> then
    'dont add it to listbox
else
    'add it to lisbox
end if
'loop faster.

How to do that ?

Thanks.
lollllll why should we back in time to
06-29-2012

btw that site for bad words not for good words so .... idk know what r u trying to make good word list :/
Shit actually had me thinking Nathan finally started releasing again, rather then just trolls.....

Seems someone likes to go grave digging LOL.
How....grotesque.
a website of the sort is a bit outlandish don't you think?
Holy mother of gravedig. Quit that shit nigga.

[Image: 1zL3pDG.jpg]



Possibly Related Threads...
Thread / Author Replies Views Last Post
[Tutorial] by mmmihai13Sep 17, 2024 03:00 AM 0 109 Sep 17, 2024 03:00 AM
Last Post: mmmihai13
[C#] by -PUBG-Jan 3, 2019 06:59 PM 17 622 Jan 3, 2019 06:59 PM
Last Post: -PUBG-
[Shell] by HackooMay 26, 2018 08:51 PM 5 260 May 26, 2018 08:51 PM
Last Post: Erhan