- [Instructor] Hi, and welcome
to the next video of section five,
Creating a define Utility by Using the Web Backend.
In the previous video,
we've seen how to generate a web photo album.
In this video, we'll use one API,
and see how to write a defined script.
There are a lot of dictionaries on the web
that offer APIs that can be used
to get a machine readable definition of words.
We're going to use Curl, sed, and grep
to write the defined utility.
There a lot of dictionary websites where you can register
and use their APIs for personal use for free.
In this example, we're using
the Merriam-Webster's Dictionary API.
Please performing the following steps.
Go to www.dictionaryapi.com/register/index.htm,
and register an account for yourself.
Select collegiate dictionary and learner's dictionary.
Log in using the newly created account
and go to my keys to access the keys.
Note down the key for the learner's dictionary.
Let's go through the code for the defined utility script.
Run the script as follows.
We use Curl to fetch the data
from the dictionary API webpage by specifying our API key
and the word that we want the definition for, $1.
The result contains definitions in the DT tags,
which we select by using grep,
and then we remove the tags by using sed.
We then pick the required number of lines
for the definitions, and use NL
to put the line numbers in each line.
Awesome, we've successfully learned
how to create a defined utility by using the web backend.
In the next video, we'll learn
how to find broken links in websites.