Gnews2RSS at VoidStar.com

An experimental convertor that takes a Google News search and turns it into RSS

">
Number of entries to return:
Search Query:

Usage: http://www.voidstar.com/gnews2rss.php?num=number_of_items&q=your_query

Example: http://www.voidstar.com/gnews2rss.php?q=wifi+OR+WLAN+OR+80211

Disclaimer Don't expect this to be here, to work, or to get fixed. But if you have a question or comment, email: julian_bond@voidstar.com

Notes: (.+?)
(.+?)(
|)%is"; $allowable_tags = "

      • "; $num = ($num) ? $num : 15 ; $url = "http://news.google.com/news?hl=en&num=$num&scoring=d&q=".urlencode($q); $ch = curl_init($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_ENCODING,""); curl_setopt ($ch, CURLOPT_HEADER, 1); $data = curl_exec($ch); curl_close ($ch); // ******************* // Some people seem to have problems with google not returning anything // uncomment the following lines and comment out the content-type header // to see what google is returning. // print ""; // print "
        ";
        //  print htmlentities($data);  
          header("Content-Type: text/xml");
        
          $data = strstr($data,"Sorted by date");
        
          eregi("(.*)", $data, $title);
          $channel_title = $title[1];
        
          $match_count = preg_match_all($itemregexp, $data, $items);
          $match_count = ($match_count > 25) ? 25 : $match_count;
          
          $output .= "\n";
          $output .= "\n";
          $output .= "\n";
        
          $output .= "\n";
          $output .= "  \n";
          $output .= "    Google News Search: $q\n";
          $output .= "    ". htmlentities($url) ."\n";
          $output .= "    Google News Search: $q\n";
          $output .= "    julian_bond@voidstar.com\n";
          $output .= "    en-us\n";
          $output .= "    <a href=\"http://www.voidstar.com/gnews2rss.php\">GNews2Rss</a>\n";
        
          $day = date("d"); 
          if (false) {
        //  if ($day == 1 || $day == 11 || $day == 21) {
            $output .= "    \n";
            $output .= "      ". date("d-M-y"). " Do you find Gnews2RSS useful?\n";
            $output .= "      http://www.voidstar.com/gnews2rss.php\n";
            $output .= "      If you're using <a href=\"http://www.voidstar.com/gnews2rss.php\">Gnews2rss</a> you presumably find it useful. Please <a href=\"mailto:news-feedback@google.com\">email Google</a> asking them to produce RSS directly out of Google News Search. And why not <a href=\"http://www.voidstar.com/gnews2rss.php.txt\">host it yourself</a> to save my bandwidth costs.\n";
            $output .= "    \n";
          }
        
          for ($i=0; $i< $match_count; $i++) {
        
            $item_url = $items[1][$i];
            $title = $items[2][$i];
            $title = strip_tags($title);
            $desc = $items[3][$i];
        
            $desc = eregi_replace(" - .* ago
        ", "
        ", $desc); $desc = strip_tags($desc, $allowable_tags); $desc = htmlspecialchars($desc); $output .= " \n"; $output .= " ". htmlspecialchars($title) ."\n"; $output .= " ". htmlspecialchars($item_url) ."\n"; $output .= " ". $desc ."\n"; $output .= " \n"; } $output .= "
        \n"; $output .= "
        \n"; print $output; //**************** // More debug stuff // print "
        ";
        //  print htmlentities($output);
        //  print "
        "; } ?>