cURL / Mailing Lists / curl-users / Single Mail

curl-users

Using cURL and the dict.org Dictionary

From: Merek Thorondursson <merek.thorondursson_at_gmail.com>
Date: Sat, 12 Dec 2015 07:48:51 -0800

I'm not writing with a problem, I'm just sharing how I use cURL as a
tool to interact with the dict.org dictionary. I became interested in
the site years ago when I was reading through the documentation about
the protocols cURL can access and Daniel gave an example using the
DICT protocol. cURL will automatically communicate with dict.org on
port 2628, so it is not necessary to use the prefix dict:// when
cURLing their site.

I am usually in front of a command line interface on an MS Windows
machine, so invoking cURL is a very fast technique for looking things
up. The dict.org dictionary site is frequently much more useful to me
for a definition than using one of the major search engines.

The dict.org website indicates that the DEFINE command can be
abbreviated _on their site_ to just d - there is no guarantee that
this will work on other sites implementing the DICT protocol, but if
you know other sites that use it you could test it. I'm not
personally aware of any other sites using the protocol, but would be
pleased if someone relayed the information if they know of them.

A quick example is: curl dict.org/d:island

Using this method, dict.org returns any found definition(s) from the
first database in which it finds anything. gcide seems to be the
first db it searches. You can force a different db like this: curl
dict.org/d:island:wn You can also force it to return hits from all
databases using curl dict.org/d:island:all or get all English
databases with curl dict.org/define:island:english

If I just want a quick definition, this is all I need to do. If it's
necessary, the -o <localfile> option is handy, or I might use | more
if the returned hits exceed my 50 line window.

Sometimes I'll redirect instead of using -o, like curl
dict.org/d:island:all > island.txt

If I've already created the file but want addtional information from
additional databases, I might use the >> redirect to append to the
existing file instead of overwriting it.

I thought I'd make up a little quick reference chart and share it with
anyone else who wants to make use of this fine dictionary set of
databases. The chart gives several good methods of fetching
information, but is not (nor is it meant to be) completely
comprehensive.

My console window defaults to the old IBM/MS-DOS CodePage 437, which I
like for its use of line drawing characters. My printer handles it
fine. If you prefer pure lower ascii, I've added a second chart at
the bottom. See attachment: curl_dict.org.nfo

If anyone else has examples of how they use cURL from the command line
(I use it for a couple of other purposes) I'd be interested to hear
other examples.

Please let me know if this list is appropriate for this
discussion/file sharing, or if somewhere else is preferable.

   --- Merek
_________________________
All that is gold does not glitter,
Not all those who wander are lost

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2015-12-12