Skip to content

Instantly share code, notes, and snippets.

@roopeshvaddepally
Created January 15, 2011 21:49
Show Gist options
  • Save roopeshvaddepally/781297 to your computer and use it in GitHub Desktop.
Save roopeshvaddepally/781297 to your computer and use it in GitHub Desktop.
# LICENCE: GPLv3
# download all the startdict dictionaries into proper directory on linux
# requirements:
# 1) lxml library for python
# 2) wget program on linux
# 3) /usr/share/stardict/dic folder must exist
# currently this works on linux only, but is a good starting point
# i am only interested in the `url`, and any other stardict dictionaries are of no interest to me
# there is no error handling what so ever, it's a quick and dirty solution.
import urllib2
import os
from lxml import html
url = "http://yeelou.com/huzheng/stardict-dic/dict.org/"
dicts = urllib2.urlopen(url).read()
dicts_html = html.fromstring(dicts)
for each in dicts_html.iterlinks():
if each[2].endswith("bz2"):
os.system("wget %s -O - | tar xj -C /usr/share/stardict/dic/" % (url + each[2]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment