Live update of local news stories

  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.

Now that Google News allows news searches by geographic location, we can combine this with a tweak of the Google Reader embedding code to get a live feed of local stories in our area.

First, let's craft our geo-specific query. From Advanced Search at http://news.google.com, we can work out that it's the geo=xxx parameter that determines our geographic bias. So a Canberra local feed is

http://news.google.com/news?hl=en&geo=canberra

But what if we don't want all news articles? What if sports stories (for example) bore us? Then we just modify the query to exclude words likely to be found in sports stories:

http://news.google.com/news?hl=en&geo=canberra&q=-sport+-play

Last, let's sort by date rather than relevance to ensure that the latest stories are always at the top:

http://news.google.com/news?hl=en&geo=canberra&q=-sport+-play&scoring=n

Here's our finished feed of stories.

If we want to embed the headlines into another page, we just have to tweak our Javascript code. The tricky bit is that our feed URL has to be escaped. Luckily, Firefox allows us to execute Javascript right from the browser bar. Just paste the following text into a blank browser window and press ENTER:

javascript:document.write(escape('http://news.google.com/news?hl=en&geo=canberra&q=-sport+-play&scoring=n'));

Et voilà:

(Courtesy of Google News)