From 6bcff92763b34409bb587e2d649436c418c9ae76 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 23 Apr 2008 21:47:47 +0000 Subject: [PATCH] * updated Anidb xpaths --- source/net/sourceforge/filebot/web/AnidbClient.java | 10 +++++----- source/net/sourceforge/tuned/XPathUtil.java | 10 ++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/source/net/sourceforge/filebot/web/AnidbClient.java b/source/net/sourceforge/filebot/web/AnidbClient.java index c85bc25f..c4154d5f 100644 --- a/source/net/sourceforge/filebot/web/AnidbClient.java +++ b/source/net/sourceforge/filebot/web/AnidbClient.java @@ -46,17 +46,17 @@ public class AnidbClient extends EpisodeListClient { Document dom = HtmlUtil.getHtmlDocument(getSearchUrl(searchterm)); - List nodes = XPathUtil.selectNodes("//TABLE[@class='anime_list']//TR//TD//ancestor::TR", dom); + List nodes = XPathUtil.selectNodes("//TABLE[@class='animelist']//TR/TD/ancestor::TR", dom); LinkedHashMap searchResults = new LinkedHashMap(nodes.size()); if (!nodes.isEmpty()) for (Node node : nodes) { - String type = XPathUtil.selectString("./TD[3]", node); + String type = XPathUtil.selectString("./TD[contains(@class,'type')]", node); // we only want shows if (type.equalsIgnoreCase("tv series")) { - Node titleNode = XPathUtil.selectNode("./TD[2]/A", node); + Node titleNode = XPathUtil.selectNode("./TD[@class='name']/A", node); String title = XPathUtil.selectString(".", titleNode); String href = XPathUtil.selectString("@href", titleNode); @@ -107,8 +107,8 @@ public class AnidbClient extends EpisodeListClient { f.setGroupingUsed(false); for (Node node : nodes) { - String number = XPathUtil.selectString("./TD[1]/A", node); - String title = XPathUtil.selectString("./TD[2]/LABEL/text()", node); + String number = XPathUtil.selectString("./TD[contains(@class,'id')]/A", node); + String title = XPathUtil.selectString("./TD[@class='title']/LABEL/text()", node); if (title.startsWith("recap")) title = title.replaceFirst("recap", ""); diff --git a/source/net/sourceforge/tuned/XPathUtil.java b/source/net/sourceforge/tuned/XPathUtil.java index 22e02d63..1db48a4c 100644 --- a/source/net/sourceforge/tuned/XPathUtil.java +++ b/source/net/sourceforge/tuned/XPathUtil.java @@ -5,7 +5,6 @@ package net.sourceforge.tuned; import java.util.ArrayList; import java.util.List; -import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; @@ -65,10 +64,9 @@ public class XPathUtil { } } - private static XPath xpathObject = XPathFactory.newInstance().newXPath(); - - - private static synchronized XPathExpression getXPath(String xpath) throws XPathExpressionException { - return xpathObject.compile(xpath); + + private static XPathExpression getXPath(String xpath) throws XPathExpressionException { + return XPathFactory.newInstance().newXPath().compile(xpath); } + }