Using Lynx to Scrape a Weather Report
November 03, 2009
Lynx As A Simple HTML Parser
One great and often-overlooked feature of Lynx is its --dump
option.
lynx --dump <url> dumps the text content of the Web page at URL,
followed by a numbered list of URLs that were referenced in that page.
As demonstrated by the screenshot above, you can use Lynx to retrieve the weather forecast for a zip code.
In this case I used grep -A 26 to limit the output shown to just 26
relevant lines.
But if I had wanted to retrieve the entire forecast page, as plain text, the basic syntax is then just:
lynx --dump http://www.weather.com/weather/local/10013
Note that this same recipe can be used to retrieve the weather
forecast for any US zip code. Just replace 10013 in any of the
examples above, with the zip code of your choice.


















Comments