* adapt to site changes
This commit is contained in:
parent
7a77530a06
commit
5feaffb7c6
|
@ -11,6 +11,7 @@ import java.net.MalformedURLException;
|
|||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.AbstractList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -127,8 +128,12 @@ public class AnidbClient implements EpisodeListProvider {
|
|||
// ignore
|
||||
}
|
||||
|
||||
// set request headers to resemble an ajax request
|
||||
URLConnection connection = url.openConnection();
|
||||
connection.setRequestProperty("X-LControl", "x-no-cache");
|
||||
|
||||
// get anime page as xml
|
||||
Document dom = getDocument(url);
|
||||
Document dom = getDocument(connection);
|
||||
|
||||
// select main title
|
||||
String animeTitle = selectString("//title[@type='main']", dom);
|
||||
|
|
|
@ -76,12 +76,12 @@ public final class WebRequest {
|
|||
|
||||
|
||||
public static Document getDocument(URL url) throws IOException, SAXException {
|
||||
return getDocument(new InputSource(getReader(url.openConnection())));
|
||||
return getDocument(url.openConnection());
|
||||
}
|
||||
|
||||
|
||||
public static Document getDocument(InputStream inputStream) throws SAXException, IOException, ParserConfigurationException {
|
||||
return getDocument(new InputSource(inputStream));
|
||||
public static Document getDocument(URLConnection connection) throws IOException, SAXException {
|
||||
return getDocument(new InputSource(getReader(connection)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public class IMDbClientTest {
|
|||
assertEquals(2004, movie.getYear());
|
||||
assertEquals(407362, movie.getImdbId(), 0);
|
||||
|
||||
assertEquals(6, results.size(), 0);
|
||||
assertEquals(7, results.size(), 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,11 +50,11 @@ public class SubsceneSubtitleClientTest {
|
|||
public void searchResultPageRedirect() throws Exception {
|
||||
List<SearchResult> results = subscene.search("firefly");
|
||||
|
||||
assertEquals(1, results.size());
|
||||
assertEquals(2, results.size());
|
||||
|
||||
HyperLink result = (HyperLink) results.get(0);
|
||||
|
||||
assertEquals("Firefly - The Complete Series", result.getName());
|
||||
assertEquals("Firefly - The Complete Series (2002)", result.getName());
|
||||
assertEquals("http://subscene.com/Firefly-The-Complete-Series/subtitles-20008.aspx", result.getURL().toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -28,12 +28,12 @@ public class TMDbClientTest {
|
|||
|
||||
@Test
|
||||
public void searchByHash() throws Exception {
|
||||
List<MovieDescriptor> results = tmdb.getMovies("Hash.getInfo", "d7aa0275cace4410");
|
||||
List<MovieDescriptor> results = tmdb.getMovies("Hash.getInfo", "2bba5c34b007153b");
|
||||
MovieDescriptor movie = results.get(0);
|
||||
|
||||
assertEquals("Iron Man", movie.getName());
|
||||
assertEquals(2008, movie.getYear());
|
||||
assertEquals(371746, movie.getImdbId());
|
||||
assertEquals("Season 1", movie.getName());
|
||||
assertEquals(2002, movie.getYear());
|
||||
assertEquals(303461, movie.getImdbId());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue