Kolbu

Computers, Gadgets and Beyond!
Subscribe


Google News plugin

April 07, 2008 By: webmaster Category: WordPress Plugins

Displays N first news items from a selectable Google News RSS feed, inline or as a widget.

Google aggregates news from over 4500 news sources, updated continously. The results can be retrieved as a number of RSS feeds, where you can create your own specific feed by specifying one of more than 40 regions/languages, and an optional topic ranging from Domestic to Most Popular to Entertainment. Currently there are nine topics, including, of course, All. In addition to this, any feed can be filtered through a search query so that only news items matching your query will be shown. Note that not all combinations of region/language and topic has been enabled by Google but it should degrade gracefully.

This plugin works both as a widget, as inline content replacement and can be used in themes. It can be used as both simultaneously, but there can be only one instance of the widget. Multiple feeds can be configured and used accordingly.

NOTE! Always upgrade to the latest version if you experience problems, most things are fixed already. :-)

The latest version is 2.5.

If you’ve configured feeds that use character sets like cyrillic, arabic and you’re getting errors from WP when trying to view the feeds then your WP MySQL database tables may be created with the wrong character set. Let me know and I’ll give you some pointers.

Download Google News plugin

If you have a question or other comment, use the form below. Thank you!


Known bugs:

  • There is a bug in the WordPress RSS engine, that sometimes show up when people use this widget. If you get something resembling “unknown function debug() in line 504 of wp-includes/rss.php” then that’s one of them. WP is aware of the problem, and apparently a fixed rss.php might be showing up in the next release. As a quick-fix edit wp-includes/rss.php and change line 503 from if ( MAGPIE_DEBUG ) { to if ( MAGPIE_DEBUG > 1 ) {
  • When the widget fails with a php error like the one above, the template goes out of whack. I’ve made sure none of those are my fault in the next minor upgrade due out soon. I’m looking at better workarounds for the bug above first, so release might be a short while yet. Don’t want to spam you all with multiple releases like some widget writers…

Example of inline content replacement.

Default feed <–google-news–>, alternating randomly between two feeds:

A different feed <–google-news#non-default–>:

Shortcode test non-default [ google-news name="non-default" ]:

Shortcode test default [ google-news ]:

Random test:

Shortcodes are only available in WordPress 2.5 and up.

146 Comments to “Google News plugin”


  1. theAdmiral says:

    Hi,

    I am getting a conflict with Ajaxed WordPress (AWP) that I cannot resolve.

    Warning: Invalid argument supplied for foreach() in /home/interact/public_html/main/wp-content/plugins/google-news/google_news_old.php on line 739

    Interesting to me is the fact that the error only occurs on the main (index.php) and not on the post (single.php) even though I am calling the feed in footer.php?

    1
  2. I have installed google news plugin in my wordpress blog, but I am not able to reate new news feed at all.

    2
  3. Hi.
    I see you are thinking about adding “nofollow” to the plug in.
    I say yes please.
    I check my site using a variety of tools from w3c. The link validation tool can’t run the Google links. I would like to also have the “noindex” rule as a check box option in the admin/ setting/ Google news along with one for “nofollow”.
    Optionally it could be for individual configuration for each use.

    One other note
    In the U.S. the political divisions go something like this Country, Region, State, State Region, County, City/Township. Could it be possible to include a drill down of some kind for this. I don’t there is a standard for this type of thing so I am sure it would be quite a challenge.

    3
  4. I installed the Google RSS reader a few days ago. It got the feeds at first, but then would display out of date feeds (as far as i can tell the first ones it ever retrieved). I switched from U.S. All to U.S. Top stories and it said something along the lines of service unavailable.

    I was wondering if Google may have changed the way it does it’s RSS. I am on your CNN reader right now with no problems.

    Thanks for your help and such great plugins!

    4
  5. Hi everyone :-)
    Sorry about the slow responses to some of the comments here, been out of the loop for a while.

    For the people having the “foreach”-problem after adding the plugin-call to a file in a theme using do_action, it looks like a bug in the plugin. The current plugin settings isn’t read from the database in all cases, so it fails. I’ll email the last few commenters with a fix and will release an update if the fix appears to have fixed the problem.

    OK

    5
  6. Hi Chance!
    Googs doesn’t appear to have changed anything. As you can see on this page, there are four test-feeds and they appear to be running fine. Are you sure you have outbound access to the Google RSS web sites? Your admin/ISP may have started blocking them or something. From your server, try fetching http://news.google.com/news?output=rss and see if it fails or not.

    I’ve also heard people say they’ve been individually blocked by Google. Presumably due to breach of their acceptable use policy, however I’m unsure exactly what they had done to deserve that. The plugin itself follows the Google AUP to the best of my knowledge.

    OK

    6
  7. Hi Ammy!
    Sorry about the late reply. Could you tell me a bit more about what you are trying to achieve and what error messages or other feedback you get from the plugin. Is it on the plugin configuration page you have problems, or do you create a feed and get no results from Google when you try to view the result?

    OK

    7
  8. Hi,

    since few days it appears this error when the plugin is actived :
    Fatal error: Call to undefined function: debug() in /home.10.23/magaziner/www/wp-includes/rss.php on line 504

    Do you think it comes from a change wich need an update ?
    If yes thanks for your support to fix it.

    Regards,
    Frank

    8
  9. Sorry for my last message, I didn’t see before the WP fix bug to change on line 504.

    Now it is working with :
    if ( MAGPIE_DEBUG ) { to if ( MAGPIE_DEBUG > 1 ) {

    Thanks again.
    Frank

    9
  10. Hello,

    First, thanks for the awesome Google news plugin that you developed for WordPress. I hope you don’t mind answering a question. I would like to show only top stories related to a specific topic (i.e. mortgage). If I add that extra search criteria under the optional query filter section, the result on my WordPress theme shows the news title first, then the next item in the list is an entry saying something like “all 8,223 news articles”, then the third item in the list is the next article title followed by a similar “all 830 news articles”.

    I would like only the news titles to display on my sidebar. Can you help me understand what I need to change? Thank you.

    10
  11. Hi,

    i want to show the news about Andalucia, a region in Spain, on my site. So how do i set the optional query filter ? I use the code to put it in the PHP files now:

    11
  12. Hi,

    I have the same problem as braddock!
    The Plugin shows:

    Google News : Österreich : Top News
    Google News unavailable

    but my tables are utf-8?

    12
  13. Michael Kydonieus says:

    I’m having a few problems.

    1) When you use the ‘short’ version, sometimes there is an extra link that says something like ’98 additional articles.’ This link opens in the same window, leading the reader away from the website. How can I get it to open in a new window? (I can hack if necessary.)

    2) When you use the ‘long’ version, ALL the links lead away from the website. Again, I would like to get them to open in a new window.

    3) How can I use a complex query, i.e. something like “Religion and Politics” or “Religion or Politics”, that uses boolean logic?

    Thanks

    13
  14. Hi Michael
    The links you see are inside the Google news content, which I’m technically not allowed to manipulate according to Google TOS. But I’ll look into adding a target=”_blank” to the links to make them use another window though, that can’t be too much against the rules.

    As for the complex query, it’s kinda limited in this release. If you just type in a list of words, that works as AND and will match articles that have all the words in them. For boolean or, you have to use the word “OR” as the first word in your word list. So “OR this that” (always without the quotes) means articles that have the word this OR the word that in them. I’m afraid that’s it for complexity at this point.

    OK

    14
  15. Thanks for coding such a great plugin. I am trying to have it working on my blog with no success so far. I am using WP version 2.6.2. It works fine as a widget. But when I try to do it as part of the theme using
    I get the error “No default feed available”. Please suggest.

    15
  16. hi,

    getting errors now with the plugin before and after i upgraded it.

    Fatal error: Call to undefined function: debug()

    any ideas? it was working fine and then it just stopped.

    Thanks!

    JL

    16
  17. Just to say that I am very gratefull for this plugin. Is is very usefull. thanks

    17
  18. After upgrading to 2.6.2 I got this message:

    =================
    Redirect Notice
    The previous page is sending you to an invalid url.
    If you do not want to visit that page, you can return to the previous page.
    =================

    Thnaks

    18
  19. Using the Manage screen doesn’t seem to work in the WP beta 2.7. I click EDIT or ADD new …and nothing happens. works ok on previous WP

    19
  20. I have installed the plugin just fine and have used it as a widget on my sidebar and also presented the headlines in the context of a page…I am curious to know if I can have the news items then displayed in my own theme or if it will always open in a new window?

    I am not versed in the programing at all and don’t know where to place the do_action(‘google_news’, ‘feedname’) code…that is what it needs in order to have the stories display in my own theme, right?

    20
  21. I’ve installed your plugin and I love it! However, I’ve noticed one minor glitch where it conflicts with my theme.

    To generate the effect:

    1. From the Home Page of my site, notice the position of the right side widgets as well as the dividing space between the widgets and the rest of the page contents.

    2. Navigate to any other page or post. I use your plugin to display Google health news so you can select “Health News” from the top menu bar.

    3. Notice how the right side widgets shift over to the left and that there is now no dividing space between the widgets and the post content. This happens on ANY page or post you navigate to. If I deactivate the plugin, the effect goes away and the widgets stay in place from page to page.

    Any ideas on why this is happening — or more specifically, how I can fix it?

    Thanks in advance.

    Hiram

    21
  22. Hi jtsone and Rasheed!
    I’m now running WP 2.7 here, and all admin-pages and other parts of the Google News plugin appears to be working fine. If you still have problems after upgrading to 2.7 final then let me know and I’ll try to debug.

    OK

    22
  23. Ah, edit/delete seems to be stuffed under 2.7 yes. I’ll find out what the WP-boys have done to the code this time around and release an updated plugin. Hopefully this weekend.

    OK

    23
  24. hi !
    i used to use google news and cnn new in my blogs but when i upgraded to wordpress 2.7 today i found a difficulty in managing my feed. I can not change anything. I wish if there is a solution for this problem even if a manual solution throgh mySql or something.
    thanx in advance

    24
  25. Waiting for your WP 2.7 compatibility update….

    please hurry :)

    Cheers,
    Alex

    25
  26. Hey Olav,

    I’ve just sent you an email. Your fix appears to be working.

    Thanks!
    Alex

    26
  27. We cannot manage the google News, No Chance to Edit, Delete or adding extra feed. We revolution templage with WP 2.7.

    Best Thomas

    27
  28. I noticed this entry:
    “46
    webmaster Says:
    June 25th, 2008 at 18:53

    Hi Karan!
    If Google is unavailable all the time, then it’s most likely a problem at your hosting provider. They may, as with Katrina, be a PHP configuration option that blocks outgoing connection attempts. It may also be a firewall that block outgoing connections. Do you have access to the webserver logs for your site? If so, see if there are PHP warnings/errors there that may indicate that outbound access is blocked. Either by PHP settings or an external firewall. Also, if you have access to the web server itself, you can try to access something remote with “telnet google 80″. If that fails, then you’re most likely firewalled. If that’s the case, the plugin won’t work unless you get them to open up. Note they will have to open for several external addresses at Google, so let me know if that’s the problem and I will provide you with the sites to open for.”

    I am having the same problem. I have contacted my hosting provider, and they want me to fill out this form:
    Please allow the outbound connections for scripts for FTP username: (my username)
    Local script filename (and location) which needs the outbound connection:
    1.
    2.

    Remote server IP address and port number:
    1.
    2.

    Exact purpose of this connection:
    1.
    2.

    Please note that our firewall is IP based. If the remote host changes its IP address in the future, please notify us of the change.
    ————

    What information should I fill this form out with?
    Thank you.
    I appreciate your time and feedback.-Jeff

    28
  29. I set up the PlugIn (Google News ver 2.4) in WP 2.3.3, today, and I get the ‘error’: “Google News unavailable”. The only filter word I passed was ‘OR Nacke Rygg’.

    Is there a problem with Google News (API) it selves?

    Regards

    29
  30. Hello,
    I have Google News plugin, worked fine for awhile, but now I am getting broken html coding on the page.

    Works good in the Item Length> short mode, when switching to long mode I get the broken html coding.

    What can cause this?

    Regards,
    Mike B

    30
  31. I’m trying to set up the RSS feed for Google news using this plug-in. However, my web host blocks outbound connections.

    They’re asking for the following information:
    Local script filename (and location) which needs the outbound connection:
    1.
    2.

    Remote server IP address and port number:
    1.
    2.

    Exact purpose of this connection:
    1.
    2.

    ——
    What do I give them for the remote server IP address and port number?
    Thank you.
    -Jeff

    31
  32. I am using WP2.7.1

    I am running two sites with WP, but the Google-News plugin only works with one of the sites.

    I put the [google-news name="business"] in a text widget, and I put the identical shortcode in my second site but it won’t work. I checked to make sure both sites were set up identically. Both use a different theme, however.

    Using the Text widget I was not able to get anything to work using

    Thanks for any help…
    Tom

    32
  33. PS – I WAS able to create a new page and put the short code into it, and the google-news worked fine, however, it still won’t work in the text widget on website number two.
    strategytrading1.com
    This one works, but the next one doesn’t work:
    hawaiitravelandweather.com

    Tom

    33
  34. Hi Tom!
    It sounds vaguely like the theme on your second site has a problem with widgets in widgets. Do you get any outout if you try a random other widget that produces some output in more or less the same manner as the Google-Newx plugin?
    OK

    34
  35. Hi Jeff
    Sorry about the late reply, takes a while to wade through the comment spam. The plugin uses the site http://news.google.com to fetch all the feeds from. This means that for IP you need (currently, Google might change this at any point in time) these four IP numbers:
    $ host news.google.com
    news.google.com is an alias for news.l.google.com.
    news.l.google.com has address 64.233.183.104
    news.l.google.com has address 64.233.183.103
    news.l.google.com has address 64.233.183.147
    news.l.google.com has address 64.233.183.99

    The port in 80 (standard http) in all cases. But NOTE! Google may be employing some kind of world wide caching system, so your server might see other IPs for news.google.com than I do from Norway. So do a host-lookup of news.google.com from your site and verify that the IPs are identical to the list above. Otherwise use the ones you get.

    35
  36. Hi Mike B!
    Google screen-scrapes news from other sites, and they’re not very good at cleaning up the HTML code they get. Especially in long mode. The plugin tries to clean up the rest, but it’s not exhaustive. So my guess in this case is that one of the current news articles has html-bugs in it, and that breaks your site. Not a lot I can do about that, but if that really is the case then the problem should disappear once the offending article is no longer listed. Is this a persistent problem?

    O

    36
  37. Hi Nisse!
    The unavailable-message can be a result of various reasons. What happens if you try a standard feed without any filtering words? Still the same problem? Can you see if you can reach the server news.google.com on port 80 from your wordpress server? Some ISPs may block outbound traffic, which is the most common scenario here.
    OK

    37
  38. I had about 10 feeds setup, added number 11, and all of them were suddenly deleted. :(

    Has anyone seen this before?

    38
  39. Hi brettbum!
    Hm, that’s a new one. I’ll try making that many feeds myself and see what happens. I can’t really think of anything in the plugin that would cause this to happen. The data about the feeds is stored in your MySQL backend database using the WordPress API, so the bug could really be anywhere. What version of WordPress are you running?
    OK

    39
  40. I’ve tried to add the code into a text widget for the sidebar, but when I go to load the page, it just posts the text that I cut and pasted into the widget.
    The code I put in is:
    [google-news name="legal"]
    and that is exactly what shows up.
    When I put that text into a post, the news feed looks fine. But I would rather have the news feed in the sidebar.

    What am I doing wrong and what is the proper code?

    40
  41. Hi Sophiedog!
    The text widget is just that, a text widget. You need something like the Executable PHP Widget for what you are attempting, see http://wordpress.org/extend/plugins/php-code-widget/
    OK

    41
  42. Andrew M says:

    Hello, I love the Google News plugin, but I have one question/suggestion. I’d like to be able to rel=nofollow the news links and can’t seem to find out where in the code to place that. A little help would be much appreciated.

    42
  43. Hi Andrew!
    This one is actually non-trivial. The content that Google provides here is really a pre-formatted HTML-blob, and all the href’s are in there. So you’d need a preg_replace() call that looks for a ‘href’ and replaces it with a ‘rel=nofollow href’. I have it on my list of possible enhancements, but just not gotten around to doing it yet. If you want a suitable place in the plugin to try this on your own, then look for the line that has ‘squat’ in it. Around there is a good place to add the preg_replace().

    OK

    43
  44. Exellent plugin, but the region/country I live in is not listed …

    For a country-specific feed not listed, can I add it manually in the script?

    Best -
    D.

    44
  45. Hello, very nice plugin, but it stopped working once I upgraded to WP 2.7. I get an invalid url message (“The previous page is sending you to an invalid url.”) upon clicking on each link this plugin delivers… Both with and without a filter. Yes, I’m using the latest 2.4 version of the plugin. Is there a cure for this yet?

    45
  46. Hi, can any one tell me where do I need to put in order to calling plugin from theme. Any help would be appriciated.

    46
  47. Hi Dan!
    The plugin lists all the regions/countries that Google provided when the plugin was released. If they have added more regions after that, then just add them manually to the script and you should be good to go. However, if you add regions not (yet) provided by Google, then nothing will happen.

    OK

    47
  48. Hi ir!
    Hm, new one to me. I’m running the plugin on several WP 2.7 sites, and haven’t had this problem at all. Can you provide me with a link to your site so I can see it fail?

    OK

    48
  49. Hi Donald!
    The accompanying documentation/readme should provide you with the html code you need, look for where it tells you to use do_action(). This information is also available on line at http://wordpress.org/extend/plugins/google-news/
    Hope this helps!
    OK

    49
  50. I love your google news plugin. I’m wondering if I missed something with the filtering. I built a string via news.google.com and put it into your filter months ago – went to change it and am not sure that I really can do what I want. (or that it was really doing what I thought)

    This is fairly simple, but I’m assuming not simple for you to pass it through to google.

    I want a page with articles about rescued shelties and another page about shelties minus the rescue articles on the other page. One filter for news.google.com could be, e.g., ‘sheltie OR “shetland sheepdog” -rescue’ – I don’t think I can ask your plugin to filter this. Basically, the dog can be either called a sheltie or a shetland sheepdog — and I want one page to be about rescues and the other about anything else.

    If I understand your comments, the plugin cannot do this. I can’t see having a page for sheltie rescue and one for shetland sheepdog rescue, etc. – there would be overlaps – So, I haven’t come up with a good way to work around this issue. The filter is so powerful and useful.

    If I do understand correctly, and I cannot use the plugin filter to mimic news.google.com, would it be reasonable for you to add a filter feature to simply accept a line of text as delivered by news.google? I’m thinking it might give a plugin user complete flexibility and make it easy for you to allow it. But, of course, I don’t know..
    For example in this case: ‘sheltie OR “shetland sheepdog” -rescue’ works or, assuming it would be something for you to just slap in, something from the URL: sheltie+OR+%22shetland+sheepdog%22+-rescue — or maybe give you the whole google URL?

    I’ve looked at a couple of other similar processes and see that yours really does a super job of getting rid of extra trash, capturing the nice pics and pieces of articles — very very nice job — I get to appreciate it more as I look around!

    Thanks again for the fine plugin!! — Joe B.

    50

1 Trackbacks/Pingbacks


Leave a Reply

*
  • Hit me

  • Current Poll

    Which sub-note are you getting?
    View Results
  • Another Test Feed