Do you guys like wordlists? I've got a few that I scraped

So yeah,

I love wordlists, I don't know why, I've made lists ever since I was little... weird I know.

Anyway, I've scraped a quite a few public domain resources and gathered some that I thought you guys might find useful/interesting. Most of them aren't mine but are under a CC license so I also host those on my site. If you have any you'd like to make me aware of (I have no interest for cracking/hacking wordlists), just let me know and I'll whip them onto my site!

Here they are!

http://joereynoldsaudio.com/wordlists/animals

3000 animals in a text file :D (scraped by me)

--

http://joereynoldsaudio.com/wordlists/countries

196 countries of the world

--

http://joereynoldsaudio.com/wordlists/planets

19,000 minor planets in the galaxy

--

http://joereynoldsaudio.com/wordlists/RoyalNavyShipNames

5,000+ royal navy ship names (scraped by me)

http://joereynoldsaudio.com/wordlists/pokemon

~700 different kinds of animal in a text file (scraped by me)

There are a few others on my site but the above are the most interesting. Sorry if this seemed spammy, just thought I'd share since If I saw these myself I'd be all over them :D

Posted Jun 1, 2015, 4:49 PM UTC · edited

323
zenflux•

I keep this snippet around to feed wikipedia articles/etc. into, could be useful to someone:

// get words in file, probably overkill  
String input = new String(Files.readAllBytes(Paths.get("text.txt")));  
System.out.println(Arrays.stream(input.split("\\s+"))  
    .filter(s -> s.matches("[a-zA-Z][a-z]*"))  
    .map(s -> s.toLowerCase())  
    .distinct()  
    .sorted()  
    .collect(Collectors.joining("\n")));  
4
KZISME•

That's pretty cool - I think it would be cool to accomplish this with images as well. Do you mind sharking the code? (I'm just curious and maybe someone else might be)

2
professorlampOP•

Sure, the code is pretty minimal for most of them.

pokemon = $('.wikitable').find('td:nth-child(2)');

$.each($(pokemon), function(){ 
console.log($(this).find('a').attr('title')); 
});

The easiest although least automated way is the above method. Inputting that into the console on http://en.wikipedia.org/wiki/List_of_Pok%C3%A9mon

will give you a giant console.log of all of the pokemon names. From there you just save the log by right-clicking it and then remove all the crud which aren't pokemon names. The whole process takes about 5 minutes.

I've scraped several sites in Python and this method does it all for you, i.e. you run the script and you immediately have your text file.

Here's the code that grabs the navy ship names:

from bs4 import BeautifulSoup
import urllib.request

FILE = open('RoyalNavyShipNames.txt','w')
root_url = 'http://wikipedia.org/wiki/List_of_ship_names_of_the_Royal_Navy_'
ship_urls = ['(A)','(B)','(C)','(D-F)','(G-H)','(I-L)','(M-N)','(O-Q)','(R-T)','(U-Z)']

for url in ship_urls:
    wiki_html = urllib.request.urlopen(root_url+url).read().decode('utf-8')
    soup = BeautifulSoup(wiki_html)
    links = soup.find_all('a')
    for link in links:
        title = str(link.get('title'))
        try:
            if title.startswith('HMS'):
                if '(page does not exist)' in title:
                    title = title[:title.index('(page does not exist)')]
                FILE.write(title)
                FILE.write('\n')
        except UnicodeEncodeError:
            continue    

Not elegant but it's a throwaway script so code quality is pretty low on my priority list.

The jQuery method is the easiest method for extracting what you need (IMO). Mainly because scraping with JS is pretty much what JS does as a language. It was built to manipulate the DOM so support for it is great.

I guess I'll explain the pokemon code quickly since it's pretty compact and has a lot to say:

First we need to grab the list of pokemon. If you view the wikipedia page, you'll see they're in a large table. In this case we target the table specifically by using $('.wikitable') and then, since we only care about the 2nd column in that table, we grab that column with .find('td:nth-child(2)');.

The whole assignment looks like this.

pokemon = $('.wikitable').find('td:nth-child(2)');

I should probably mention that having knowledge of HTML and CSS really helps with scraping.

Next all we need to do is iterate through all of our pokemon, find the 'title' attribute in the hyperlink, and send that to the console:

$.each($(pokemon), function(){ 
console.log($(this).find('a').attr('title')); 
});

You will find that in most cases, the 'pokemon method' above, works just fine when you rename a few elements. Hope that helped! :)

1