Grouper Documentation
Grouper Documentation
twitter youtube linkedin google-plus
Grouper: RSS manager, XML converter, website scraper
Web This Site

Grouper - Documentation


Getting Started: Free Download | Purchase | Install
Reference: Functions | Plugins | Themes
Etc.: Configure | Affiliates

Google News Plugin - Old Version

The Google News-Old plugin can be used to search Google News for news items, blog posts, etc.

IMPORTANT NOTE: This plugin has been replaced by a new version which utilizes the RSS feeds generated natively by Google News. This version is provided only for compatibility with languages and/or "editions" for which Google News does not yet generate an RSS feed. No support will be provided for this plugin in conjunction with language/edition combinations for which Google News supplies a feed.

Installation:
To use the Google News-Old plugin, google-old.php must be located in the "plugins" folder inside the folder containing grouper.php. This is the default location when Grouper Evolution is installed.

Use:
The following code searches Google News and outputs the results in RSS format. Note that unlike the newer Google News plugin, you must configure the language and edition you wish to search. Check Google News for valid values.

NOTE: Google News currently determines the encoding of its output based on the "User-Agent" header sent by the program performing the search. It appears that they return ISO-8859-1 to User Agents that they don't recognize (such as Grouper), and UTF-8 to User Agents that they know can handle it (such as Mozilla). The following example code tells Grouper to pretend to be "Mozilla/5.0" in order to make Google News return the results in UTF-8. This plugin requests the search results in UTF-8 by default, so Grouper's "encoding-in/request" setting (or the plugin's "encoding" in Grouper 1.6.1 and earlier) is not altered by this code. We recommend setting the "encoding-in/request" configuration setting if you want a different encoding, even though Google ignores it now, just in case they decide to start honoring it later:

<?php
require_once '/YOUR/PATH/TO/grouper/grouper.php';
GrouperLoadPlugin('google-old.php');
GrouperSourceConf('language','de');
GrouperSourceConf('edition','de');
GrouperConf('useragent','Mozilla/5.0'); // see note above
GrouperShow('SEARCH TERMS','CACHE-FILE-NAME');
?>

Configuration:
You may configure the behavior of the Google News plugin using the function GrouperSourceConf, as follows:

GrouperSourceConf('OptionName','new value');

See the options listed for Google News on this page for a description of the options available for the Google News-Old plugin. Additionally, the old plugin supports the options listed for the Regex plugin.