Gnews2RSS at VoidStar.com

Ein Experiment, das eine Google-News-Suche in RSS umwandelt

">
Anzahl der gewünschten Einträge:
Suche:

Syntax: http://www.example.com/gnews2rss-de.php?num=zahl_der_eintraege&q=suchbegriff

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

Disclaimer: Bitte nicht erwarten, dass das hier funktioniert oder repariert wird. Julian Bond, der Verfasser des Skripts ist (auf Englisch) für Fragen und Kommentare erreichbar: julian_bond@voidstar.com

Hinweise: (.+?)
(.+?)

%is"; $allowable_tags = "


      • "; $num = ($num) ? $num+1 : 16 ; $url = "http://news.google.de/news?num=$num&hl=de&edition=de&scoring=d&btnG=News-Suche&q=".urlencode($q); if ($fp = @fopen($url, "r")) { while (!feof($fp)) $data .= fgets($fp, 128); fclose($fp); } // ******************* // Manche Leute haben anscheinend das Problem, dass Google nichts zurückliefert: // // Wenn man die Auskommentierung der folgenden Zeilen wegnimmt und // stattdessen den Content-Type-Header auskommentiert, // kann man schauen, was Google zurückliefert. // print ""; // print "
        ";
        //  print htmlentities($data);  
          header("Content-Type: text/xml");
        
        
          $data = strstr($data,"Sortiert nach Datum");
        
          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 Suche: $q\n";
          $output .= "    ". htmlentities($url) ."\n";
          $output .= "    Google News Suche: $q\n";
          $output .= "    julian_bond@voidstar.com\n";
          $output .= "    de\n";
          $output .= "    <a href=\"http://www.voidstar.com/gnews2rss.php\">GNews2Rss</a>\n";
        
          $day = date("d"); 
          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 Gnews2rss 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(" - .* gefunden
        ", "
        ", $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 "
        "; } ?>