From 5555e2017b463265af5d81f89425880fa12bd882 Mon Sep 17 00:00:00 2001 From: 0x1f595 <0x1f595@users.noreply.github.com> Date: Tue, 21 Jan 2020 18:29:17 -0700 Subject: [PATCH] Fix Pawoo ripper pagination The generic Mastodon ripper mostly worked as a base for this ripper, but Pawoo uses a custom web UI that changes how navigation links work, so I've updated it to use the correct selector. --- .../ripme/ripper/rippers/PawooRipper.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/PawooRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/PawooRipper.java index 8f5c8c37..31817c84 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/PawooRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/PawooRipper.java @@ -3,6 +3,11 @@ package com.rarchives.ripme.ripper.rippers; import java.io.IOException; import java.net.URL; +import com.rarchives.ripme.utils.Http; + +import org.jsoup.nodes.Document; +import org.jsoup.select.Elements; + public class PawooRipper extends MastodonRipper { public PawooRipper(URL url) throws IOException { super(url); @@ -17,4 +22,17 @@ public class PawooRipper extends MastodonRipper { public String getDomain() { return "pawoo.net"; } + + + @Override + // Pawoo uses a custom theme that has different navigation links + public Document getNextPage(Document doc) throws IOException { + Elements hrefs = doc.select(".pagination a[rel=\"next\"]"); + if (hrefs.isEmpty()) { + throw new IOException("No more pages"); + } + String nextUrl = hrefs.last().attr("href"); + sleep(500); + return Http.url(nextUrl).get(); + } }