Japan's recent earthquakes in XML
You can get an XML file with the list of earthquakes that occured in the last 7 days in Japan, including direct links to maps from my server, it's updated each hour. (最近の地震がXMLでこちら)
If I have some time to kill, I will maybe add a small widget in this blog's sidebar displaying the info it gives.
Or you can build your own using this cron job:
#!/bin/bash OUT="$1" if [ -z "$OUT" ] then echo "Usage: $0 <out.xml>" exit 1 fi touch "$OUT" || exit 1 export LC_TYPE=C cat >"$OUT" <<EOF <?xml version="1.0" encoding="UTF-8"?> <!-- Recent earthquakes in Japan (updated hourly) --> <earthquakes updated="$(date)"> EOF wget -O - 'http://earthquake.usgs.gov/eqcenter/catalogs/feed.php?feed=eqs7day-M2.5.xml' 2>/dev/null | grep Japan | while read LINE ; do LINE=$(echo $LINE | sed "s/\(<[^\>]\+>\)\+/|/g" | sed 's/^|//' | sed 's/|$//') DATE=$(echo $LINE | cut -d\| -f1) TIMESTAMP=$(date -d "$DATE" +%s) SUMMARY=$(echo $LINE | cut -d\| -f2) URL=$(echo $LINE | cut -d\| -f4) LAT=$(echo $LINE | cut -d\| -f5) LON=$(echo $LINE | cut -d\| -f6) DEPTH=$(echo $LINE | cut -d\| -f9) IMAGE=$(echo $URL | sed "s/^.\+\([^\\/][^\\/][^\\/][^\\/]\).php/http:\/\/neic.usgs.gov\/neis\/bulletin\/neic_\1.jpg/") MAGNITUDE=$(echo $SUMMARY | cut -d, -f1 | sed 's/M //') LOCATION=$(echo $SUMMARY | sed "s/^[^\,]\+, //") cat >>"$OUT" <<EOF <earthquake stamp="${TIMESTAMP}"> <date>${DATE}</date> <place>${LOCATION}</place> <url>${URL}</url> <img>${IMAGE}</img> <lat>${LAT}</lat> <lon>${LON}</lon> <depth>${DEPTH}</depth> <mag>${MAGNITUDE}</mag> </earthquake> EOF done cat >>"$OUT" <<EOF </earthquakes> EOF
Leave a Comment