X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Freactor%2Ffilters%2FKickAssTorrentsFilter.java;h=9241ce78b6d0b124c76dce75c8c8092609672a1d;hb=13a4fe6bece23b3dd561de657cf9bb7ea307e2b6;hp=02a356af9e039f4729cb6f8f4c19ad768bcd699f;hpb=9bb2923cab6693bd736c1bd7d297e94e9d81d150;p=rhynodge.git diff --git a/src/main/java/net/pterodactylus/reactor/filters/KickAssTorrentsFilter.java b/src/main/java/net/pterodactylus/reactor/filters/KickAssTorrentsFilter.java index 02a356a..9241ce7 100644 --- a/src/main/java/net/pterodactylus/reactor/filters/KickAssTorrentsFilter.java +++ b/src/main/java/net/pterodactylus/reactor/filters/KickAssTorrentsFilter.java @@ -69,9 +69,12 @@ public class KickAssTorrentsFilter implements Filter { String size = extractSize(dataRow); String magnetUri = extractMagnetUri(dataRow); String downloadUri; + int fileCount = extractFileCount(dataRow); + int seedCount = extractSeedCount(dataRow); + int leechCount = extractLeechCount(dataRow); try { downloadUri = new URI(((HtmlState) state).uri()).resolve(extractDownloadUri(dataRow)).toString(); - TorrentFile torrentFile = new TorrentFile(name, size, magnetUri, downloadUri); + TorrentFile torrentFile = new TorrentFile(name, size, magnetUri, downloadUri, fileCount, seedCount, leechCount); torrentState.addTorrentFile(torrentFile); } catch (URISyntaxException use1) { /* ignore; if uri was wrong, we wouldn’t be here. */ @@ -129,4 +132,37 @@ public class KickAssTorrentsFilter implements Filter { return dataRow.select("a.idownload:not(.partner1Button)").attr("href"); } + /** + * Extracts the file count from the given row. + * + * @param dataRow + * The row to extract the file count from + * @return The extracted file count + */ + private static int extractFileCount(Element dataRow) { + return Integer.valueOf(dataRow.select("td:eq(2)").text()); + } + + /** + * Extracts the seed count from the given row. + * + * @param dataRow + * The row to extract the seed count from + * @return The extracted seed count + */ + private static int extractSeedCount(Element dataRow) { + return Integer.valueOf(dataRow.select("td:eq(4)").text()); + } + + /** + * Extracts the leech count from the given row. + * + * @param dataRow + * The row to extract the leech count from + * @return The extracted leech count + */ + private static int extractLeechCount(Element dataRow) { + return Integer.valueOf(dataRow.select("td:eq(5)").text()); + } + }