January 2004
Intermediate to advanced
368 pages
7h 25m
English
Another straightforward use of website scraping that illustrates yet a different approach is a weather forecast tool. Specify a zip code, and this script goes to the Census Bureau to obtain population and latitude/longitude information. It visits AccuWeather to extract the current weather in that region.
#!/bin/sh # weather - Reports the weather forecast, including lat/long, for a zip code. llurl="http://www.census.gov/cgi-bin/gazetteer?city=&state=&zip=" wxurl="http://wwwa.accuweather.com" wxurl="$wxurl/adcbin/public/local_index_print.asp?zipcode=" if [ "$1" = "-a" ] ; then size=999; shift else size=5 fi if [ $# -eq 0 ] ; then echo "Usage: $0 [-a] zipcode" >&2 exit 1 fi if [ $size -eq 5 ] ; then ...
Read now
Unlock full access