From e7da3d234030300c79c2e24ef5aacb91f7a5fb90 Mon Sep 17 00:00:00 2001 From: allo Date: Fri, 1 Jun 2007 14:44:46 +0000 Subject: [PATCH] fixed sitemap url in getpageinfo added suggested tags/keywords in getpageinfo git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3780 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/xml/util/getpageinfo_p.java | 40 ++++++++++++++++-------------- htroot/xml/util/getpageinfo_p.xml | 5 ++++ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/htroot/xml/util/getpageinfo_p.java b/htroot/xml/util/getpageinfo_p.java index 86f57d4ef..7c189fa2e 100644 --- a/htroot/xml/util/getpageinfo_p.java +++ b/htroot/xml/util/getpageinfo_p.java @@ -46,19 +46,21 @@ // if the shell's current path is HTROOT package xml.util; import java.io.IOException; +import java.io.Writer; import java.net.MalformedURLException; import java.util.ArrayList; -import java.util.Iterator; -import de.anomic.data.htmlTools; + import de.anomic.data.robotsParser; +import de.anomic.htmlFilter.htmlFilterContentScraper; +import de.anomic.htmlFilter.htmlFilterWriter; import de.anomic.http.httpHeader; import de.anomic.http.httpc; import de.anomic.net.URL; import de.anomic.plasma.plasmaSwitchboard; +import de.anomic.server.serverFileUtils; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; -import de.anomic.tools.nxTools; public class getpageinfo_p { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { @@ -81,22 +83,20 @@ public class getpageinfo_p { if (actions.indexOf("title")>=0) { try { URL u = new URL(url); - content = nxTools.strings(httpc.wget(u, u.getHost(), 6000, null, null, ((plasmaSwitchboard) env).remoteProxyConfig, null)); - Iterator it = content.iterator(); - String line; - String title; - while (it.hasNext()) { - line = (String) it.next(); - try { - title = line.substring(line.toLowerCase().indexOf( - "") + 7, line.toLowerCase().indexOf( - "")); - // de-replace html entities - title = htmlTools.deReplaceHTML(title); - prop.put("title", title); - } catch (IndexOutOfBoundsException e) { - } + String contentString=new String(httpc.wget(u, u.getHost(), 6000, null, null, ((plasmaSwitchboard) env).remoteProxyConfig, null)) ; + + htmlFilterContentScraper scraper = new htmlFilterContentScraper(u); + //OutputStream os = new htmlFilterOutputStream(null, scraper, null, false); + Writer writer = new htmlFilterWriter(null,null,scraper,null,false); + serverFileUtils.write(contentString,writer); + writer.close(); + + prop.put("title", scraper.getTitle()); + String list[]=scraper.getKeywords(); + for(int i=0;i#[title]# #(robots-allowed)#0::1::#(/robots-allowed)# #[sitemap]# + + #{tags}# + + #{/tags}# + \ No newline at end of file