commit
81fcff3fc1
@ -73,7 +73,7 @@ public class GfycatRipper extends AbstractSingleFileRipper {
|
|||||||
@Override
|
@Override
|
||||||
public List<String> getURLsFromPage(Document doc) {
|
public List<String> getURLsFromPage(Document doc) {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
Elements videos = doc.select("source#mp4Source");
|
Elements videos = doc.select("source");
|
||||||
String vidUrl = videos.first().attr("src");
|
String vidUrl = videos.first().attr("src");
|
||||||
if (vidUrl.startsWith("//")) {
|
if (vidUrl.startsWith("//")) {
|
||||||
vidUrl = "http:" + vidUrl;
|
vidUrl = "http:" + vidUrl;
|
||||||
@ -95,9 +95,9 @@ public class GfycatRipper extends AbstractSingleFileRipper {
|
|||||||
url = new URL(url.toExternalForm().replace("/gifs/detail", ""));
|
url = new URL(url.toExternalForm().replace("/gifs/detail", ""));
|
||||||
|
|
||||||
Document doc = Http.url(url).get();
|
Document doc = Http.url(url).get();
|
||||||
Elements videos = doc.select("source#mp4Source");
|
Elements videos = doc.select("source");
|
||||||
if (videos.isEmpty()) {
|
if (videos.isEmpty()) {
|
||||||
throw new IOException("Could not find source#mp4source at " + url);
|
throw new IOException("Could not find source at " + url);
|
||||||
}
|
}
|
||||||
String vidUrl = videos.first().attr("src");
|
String vidUrl = videos.first().attr("src");
|
||||||
if (vidUrl.startsWith("//")) {
|
if (vidUrl.startsWith("//")) {
|
||||||
|
@ -11,7 +11,7 @@ public class GfycatRipperTest extends RippersTest {
|
|||||||
* Rips correctly formatted URL directly from Gfycat
|
* Rips correctly formatted URL directly from Gfycat
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void GfycatGoodURL() throws IOException{
|
public void testGfycatGoodURL() throws IOException{
|
||||||
GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/TemptingExcellentIchthyosaurs"));
|
GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/TemptingExcellentIchthyosaurs"));
|
||||||
testRipper(ripper);
|
testRipper(ripper);
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ public class GfycatRipperTest extends RippersTest {
|
|||||||
* Rips badly formatted URL directly from Gfycat
|
* Rips badly formatted URL directly from Gfycat
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void GfycatBadURL() throws IOException {
|
public void testGfycatBadURL() throws IOException {
|
||||||
GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/gifs/detail/limitedtestyamericancrow"));
|
GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/gifs/detail/limitedtestyamericancrow"));
|
||||||
testRipper(ripper);
|
testRipper(ripper);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user