1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

* 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) { for (Node node : nodes) {
Node link = selectNode("./TD[@class='name']/A", node); Node link = selectNode("./TD[@class='name']/A", node);
// prefer title that is similar to the search query String title = getTextContent(link);
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 href = getAttribute("href", link); String href = getAttribute("href", link);
try { try {

View File

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