From f645408ae9fadec29e8fc5bc05ed3bdf82adc244 Mon Sep 17 00:00:00 2001 From: orbiter Date: Thu, 29 Nov 2007 22:12:01 +0000 Subject: [PATCH] added url retrieve option to uls.xml interface git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4239 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/urls.java | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/htroot/yacy/urls.java b/htroot/yacy/urls.java index cb50d7c98..089c73222 100644 --- a/htroot/yacy/urls.java +++ b/htroot/yacy/urls.java @@ -27,6 +27,7 @@ import java.io.IOException; import de.anomic.http.httpHeader; +import de.anomic.index.indexURLEntry; import de.anomic.plasma.plasmaCrawlEntry; import de.anomic.plasma.plasmaCrawlNURL; import de.anomic.plasma.plasmaSwitchboard; @@ -57,7 +58,6 @@ public class urls { if (post.get("call", "").equals("remotecrawl")) { // perform a remote crawl url handover int stackType = plasmaCrawlNURL.STACK_TYPE_LIMIT; - //int stackType = plasmaCrawlNURL.STACK_TYPE_CORE; int count = Math.min(100, post.getInt("count", 0)); int c = 0; plasmaCrawlEntry entry; @@ -87,6 +87,35 @@ public class urls { prop.put("item", c); prop.putHTML("response", "ok"); } + + if (post.get("call", "").equals("urlhashlist")) { + // retrieve a list of urls from the LURL-db by a given list of url hashes + String urlhashes = post.get("hashes", ""); + if (urlhashes.length() % 12 != 0) return prop; + int count = urlhashes.length() / 12; + int c = 0; + indexURLEntry entry; + indexURLEntry.Components comp; + yacyURL referrer; + for (int i = 0; i < count; i++) { + entry = sb.wordIndex.loadedURL.load(urlhashes.substring(12 * i, 12 * (i + 1)), null, 0); + if (entry == null) continue; + // find referrer, if there is one + referrer = sb.getURL(entry.referrerHash()); + // create RSS entry + comp = entry.comp(); + prop.put("item_" + c + "_title", comp.title()); + prop.putHTML("item_" + c + "_link", comp.url().toNormalform(true, false)); + prop.putHTML("item_" + c + "_referrer", (referrer == null) ? "" : referrer.toNormalform(true, false)); + prop.putHTML("item_" + c + "_description", comp.title()); + prop.put("item_" + c + "_author", comp.author()); + prop.put("item_" + c + "_pubDate", serverDate.shortSecondTime(entry.moddate())); + prop.put("item_" + c + "_guid", entry.hash()); + c++; + } + prop.put("item", c); + prop.putHTML("response", "ok"); + } // return rewrite properties return prop;