Script to Download Fonts in Bulk From

Being into design related stuff since joining college, I've found it a necessity to maintain a decent font collection. In this post, I will share and explain the script which helped me to create my collection.

What my script does is download fonts directly off a top 20 list of fonts from, for each sub-category available there.

The website has a very organized way to let users download fonts. First, there are categories like Fancy, Foreign Look, Techno, Gothic etc. Under each of these categories, there are sub-categories. Each subcategory has an ID which will help our purpose.

You can just change the ID range in the script to download fonts of different category.

The Script

#! /usr/bin/python

# Name: Bulk Download Tool
# Version: 0.3
# Summary: A tool for downloading top 20 fonts of each sub-category of
# License: BSD
# Author: Pranav Ashok
# Author-email:
# Author-homepage:
# Support:
# Support: Twitter (@pranavashok)

from BeautifulSoup import BeautifulSoup
import re
import os
import commands
import string

for cat in range(101, 119): #ID Range 101-119
	url = '' % cat
	contents = commands.getoutput("curl -s '"+url+"'")

	w = open('', 'a')
	soup = BeautifulSoup(contents)
	directory = soup.find('title').contents
	wholeTag = soup.findAll('a', {"class" : "dl"})
	directory[0] = string.rstrip(directory[0], " |")
	fontCat, useless, subCat = directory[0].partition(" > ")
	w.write('mkdir \"%s\"\n' % fontCat)
	w.write('cd \"%s\"\n' % fontCat)

	w.write('mkdir \"%s\"\n' % subCat)
	w.write('cd \"%s\"\n' % subCat)
	for link in wholeTag:
		name = os.path.basename(link['href'])
		fileName, fileExt = os.path.splitext(name)
		fileName = string.lstrip(fileName, "?f=")
		w.write('wget -c -O \"\" \"%s\" \n' % (fileName, link['href']))
	w.write('cd ..\n')
	w.write('cd ..\n')

Continue reading Script to Download Fonts in Bulk From