* adapt to site changes

This commit is contained in:
Reinhard Pointner 2009-08-17 14:19:07 +00:00
parent 58539942c5
commit 3dd8bb5c66
2 changed files with 4 additions and 15 deletions

View File

@ -59,18 +59,7 @@ public class AnidbClient implements EpisodeListProvider {
for (Node node : nodes) {
Node link = selectNode("./TD[@class='name']/A", node);
// prefer title that is similar to the search query
String title = selectString("./following-sibling::*[@class='match']", link);
// remove leading and trailing parenthesis
title = title.replaceAll("(^\\()|(\\)$)", "");
if (title.isEmpty()) {
// fallback: use main title
title = getTextContent(link);
}
// anime page
String title = getTextContent(link);
String href = getAttribute("href", link);
try {

View File

@ -72,9 +72,9 @@ public class AnidbClientTest {
@Test
public void searchReturnMatchingTitle() throws Exception {
// Seikai no Senki (main title), Banner of the Stars (official english title)
assertEquals("Banner of the Stars", anidb.search("banner of the stars").get(0).getName());
public void searchTitleAlias() throws Exception {
// Seikai no Senki (main title), Banner of the Stars (official English title)
assertEquals("Seikai no Senki", anidb.search("banner of the stars").get(0).getName());
assertEquals("Seikai no Senki", anidb.search("seikai no senki").get(0).getName());
// no matching title