From 61c56439e0be7df51b594fb82ea1293ae6ec3a5e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 26 Aug 2015 06:42:07 +0200 Subject: [PATCH] Fixed parsing of KickAssTorrents --- .../filters/torrents/KickAssTorrentsFilter.java | 4 +- .../torrents/KickAssTorrentsFilterTest.java | 28 +- .../filters/torrents/kickass-to-results.html | 550 +++++++++------------ 3 files changed, 258 insertions(+), 324 deletions(-) diff --git a/src/main/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilter.java b/src/main/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilter.java index 1b4bb05..8deead6 100644 --- a/src/main/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilter.java +++ b/src/main/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilter.java @@ -69,7 +69,7 @@ public class KickAssTorrentsFilter extends TorrentSiteFilter { */ @Override protected String extractMagnetUri(Element dataRow) { - return dataRow.select("a.imagnet").attr("href"); + return dataRow.select("a[title=Torrent magnet link]").attr("href"); } /** @@ -77,7 +77,7 @@ public class KickAssTorrentsFilter extends TorrentSiteFilter { */ @Override protected String extractDownloadUri(Element dataRow) { - return dataRow.select("a.idownload:not(.partner1Button)").attr("href"); + return dataRow.select("a[title=Download torrent file]").attr("href"); } /** diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilterTest.java index 75a9c09..73657bc 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilterTest.java @@ -33,20 +33,20 @@ public class KickAssTorrentsFilterTest { Elements torrentRows = filter.getDataRows(document); MatcherAssert.assertThat(torrentRows, Matchers.contains( - matchesTorrent("ubuntu 14.10 desktop amd64.iso", "1.08 GB", "magnet:?xt=urn:btih:2CCB0AFFD641FB6A4B5395C602BE71B43AB85B5A&dn=ubuntu+14+10+desktop+amd64+iso&tr=http%3A%2F%2Ftracker.aletorrenty.pl%3A2710%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/2CCB0AFFD641FB6A4B5395C602BE71B43AB85B5A.torrent?title=[kickass.to]ubuntu.14.10.desktop.amd64.iso", 1, 5, 2), - matchesTorrent("ubuntu gnome 14.10 desktop amd64.iso", "998 MB", "magnet:?xt=urn:btih:DD2FD99B6DE623B14146EA32E659AAE44FE0E15D&dn=ubuntu+gnome+14+10+desktop+amd64+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/DD2FD99B6DE623B14146EA32E659AAE44FE0E15D.torrent?title=[kickass.to]ubuntu.gnome.14.10.desktop.amd64.iso", 1, 4, 1), - matchesTorrent("Ubuntu Utopic 14.10 Server AMD64.iso", "582 MB", "magnet:?xt=urn:btih:EC5CE22050E0E3D7E7A279C241901B5BC1F36FE7&dn=ubuntu+utopic+14+10+server+amd64+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/EC5CE22050E0E3D7E7A279C241901B5BC1F36FE7.torrent?title=[kickass.to]ubuntu.utopic.14.10.server.amd64.iso", 1, 13, 0), - matchesTorrent("Ubuntu Utopic 14.10 Server i386.iso", "576 MB", "magnet:?xt=urn:btih:108F0624B9FD0AB708FA284F6B1F3C3022BDEDD6&dn=ubuntu+utopic+14+10+server+i386+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/108F0624B9FD0AB708FA284F6B1F3C3022BDEDD6.torrent?title=[kickass.to]ubuntu.utopic.14.10.server.i386.iso", 1, 4, 0), - matchesTorrent("ubuntu 14.10 desktop amd64.iso", "1.08 GB", "magnet:?xt=urn:btih:F7D6ECA0E176901119A7457C917A9A3547CB3CC3&dn=ubuntu+14+10+desktop+amd64+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/F7D6ECA0E176901119A7457C917A9A3547CB3CC3.torrent?title=[kickass.to]ubuntu.14.10.desktop.amd64.iso", 1, 0, 0), - matchesTorrent("Ubuntu 14.10 Desktop 32bit ISO", "1.11 GB", "magnet:?xt=urn:btih:1619ECC9373C3639F4EE3E261638F29B33A6CBD6&dn=ubuntu+14+10+desktop+32bit+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/1619ECC9373C3639F4EE3E261638F29B33A6CBD6.torrent?title=[kickass.to]ubuntu.14.10.desktop.32bit.iso", 1, 90, 13), - matchesTorrent("Ubuntu 14.10 Desktop 64bit ISO", "1.08 GB", "magnet:?xt=urn:btih:B415C913643E5FF49FE37D304BBB5E6E11AD5101&dn=ubuntu+14+10+desktop+64bit+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/B415C913643E5FF49FE37D304BBB5E6E11AD5101.torrent?title=[kickass.to]ubuntu.14.10.desktop.64bit.iso", 1, 228, 32), - matchesTorrent("ubuntu gnome 14.10 beta2 desktop amd64.iso", "993 MB", "magnet:?xt=urn:btih:5D31B3DD8FA36E04B8FEA196F133056672567BCA&dn=ubuntu+gnome+14+10+beta2+desktop+amd64+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/5D31B3DD8FA36E04B8FEA196F133056672567BCA.torrent?title=[kickass.to]ubuntu.gnome.14.10.beta2.desktop.amd64.iso", 1, 12, 2), - matchesTorrent("ubuntukylin 14.10 beta2 desktop amd64.iso", "1.27 GB", "magnet:?xt=urn:btih:9EDE5CF4F404030251F8319234CE81157D4FE001&dn=ubuntukylin+14+10+beta2+desktop+amd64+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/9EDE5CF4F404030251F8319234CE81157D4FE001.torrent?title=[kickass.to]ubuntukylin.14.10.beta2.desktop.amd64.iso", 1, 3, 0), - matchesTorrent("ubuntukylin 14.10 beta2 desktop i386.iso", "1.28 GB", "magnet:?xt=urn:btih:E97417DB2F25D0FD87F7DF1E7B3B44CE1212F38E&dn=ubuntukylin+14+10+beta2+desktop+i386+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/E97417DB2F25D0FD87F7DF1E7B3B44CE1212F38E.torrent?title=[kickass.to]ubuntukylin.14.10.beta2.desktop.i386.iso", 1, 2, 0), - matchesTorrent("ubuntustudio 14.10 beta2 dvd amd64.iso", "2.06 GB", "magnet:?xt=urn:btih:9230D72299A38213609104661181FE46918B6455&dn=ubuntustudio+14+10+beta2+dvd+amd64+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/9230D72299A38213609104661181FE46918B6455.torrent?title=[kickass.to]ubuntustudio.14.10.beta2.dvd.amd64.iso", 1, 2, 0), - matchesTorrent("Ubuntustudio 14.10 Beta2 i386.iso", "2.19 GB", "magnet:?xt=urn:btih:6C50D760243D02D238726F6A62D6725F667E1AA9&dn=ubuntustudio+14+10+beta2+i386+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/6C50D760243D02D238726F6A62D6725F667E1AA9.torrent?title=[kickass.to]ubuntustudio.14.10.beta2.i386.iso", 1, 2, 0), - matchesTorrent("Ubuntu 14.10 Desktop AMD64.iso", "1.1 GB", "magnet:?xt=urn:btih:18FC1F0208015A23BC08AD3AC5BDD2C46E20E8D0&dn=ubuntu+14+10+desktop+amd64+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/18FC1F0208015A23BC08AD3AC5BDD2C46E20E8D0.torrent?title=[kickass.to]ubuntu.14.10.desktop.amd64.iso", 1, 1, 0), - matchesTorrent("Ubuntu Utopic 14.10 Desktop i386.iso", "1.12 GB", "magnet:?xt=urn:btih:54ADDC06D2DD7BF33DDFA9DB49FEA1A79C990D44&dn=ubuntu+utopic+14+10+desktop+i386+iso&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce", "http://torcache.net/torrent/54ADDC06D2DD7BF33DDFA9DB49FEA1A79C990D44.torrent?title=[kickass.to]ubuntu.utopic.14.10.desktop.i386.iso", 1, 2, 0) + matchesTorrent("ubuntu 14.10 desktop amd64.iso", "1.08 GB", "magnet:?xt=urn:btih:2CCB0AFFD641FB6A4B5395C602BE71B43AB85B5A&dn=ubuntu+14+10+desktop+amd64+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/2CCB0AFFD641FB6A4B5395C602BE71B43AB85B5A.torrent?title=[kat.cr]ubuntu.14.10.desktop.amd64.iso", 1, 1, 0), + matchesTorrent("ubuntu gnome 14.10 desktop amd64.iso", "998 MB", "magnet:?xt=urn:btih:DD2FD99B6DE623B14146EA32E659AAE44FE0E15D&dn=ubuntu+gnome+14+10+desktop+amd64+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/DD2FD99B6DE623B14146EA32E659AAE44FE0E15D.torrent?title=[kat.cr]ubuntu.gnome.14.10.desktop.amd64.iso", 1, 2, 0), + matchesTorrent("Ubuntu Utopic 14.10 Server AMD64.iso", "582 MB", "magnet:?xt=urn:btih:EC5CE22050E0E3D7E7A279C241901B5BC1F36FE7&dn=ubuntu+utopic+14+10+server+amd64+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/EC5CE22050E0E3D7E7A279C241901B5BC1F36FE7.torrent?title=[kat.cr]ubuntu.utopic.14.10.server.amd64.iso", 1, 7, 0), + matchesTorrent("Ubuntu Utopic 14.10 Server i386.iso", "576 MB", "magnet:?xt=urn:btih:108F0624B9FD0AB708FA284F6B1F3C3022BDEDD6&dn=ubuntu+utopic+14+10+server+i386+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/108F0624B9FD0AB708FA284F6B1F3C3022BDEDD6.torrent?title=[kat.cr]ubuntu.utopic.14.10.server.i386.iso", 1, 7, 0), + matchesTorrent("ubuntu 14.10 desktop amd64.iso", "1.08 GB", "magnet:?xt=urn:btih:F7D6ECA0E176901119A7457C917A9A3547CB3CC3&dn=ubuntu+14+10+desktop+amd64+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/F7D6ECA0E176901119A7457C917A9A3547CB3CC3.torrent?title=[kat.cr]ubuntu.14.10.desktop.amd64.iso", 1, 0, 0), + matchesTorrent("Ubuntu 14.10 Desktop 32bit ISO", "1.11 GB", "magnet:?xt=urn:btih:1619ECC9373C3639F4EE3E261638F29B33A6CBD6&dn=ubuntu+14+10+desktop+32bit+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/1619ECC9373C3639F4EE3E261638F29B33A6CBD6.torrent?title=[kat.cr]ubuntu.14.10.desktop.32bit.iso", 1, 87, 15), + matchesTorrent("Ubuntu 14.10 Desktop 64bit ISO", "1.08 GB", "magnet:?xt=urn:btih:B415C913643E5FF49FE37D304BBB5E6E11AD5101&dn=ubuntu+14+10+desktop+64bit+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/B415C913643E5FF49FE37D304BBB5E6E11AD5101.torrent?title=[kat.cr]ubuntu.14.10.desktop.64bit.iso", 1, 150, 8), + matchesTorrent("ubuntu gnome 14.10 beta2 desktop amd64.iso", "993 MB", "magnet:?xt=urn:btih:5D31B3DD8FA36E04B8FEA196F133056672567BCA&dn=ubuntu+gnome+14+10+beta2+desktop+amd64+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/5D31B3DD8FA36E04B8FEA196F133056672567BCA.torrent?title=[kat.cr]ubuntu.gnome.14.10.beta2.desktop.amd64.iso", 1, 0, 0), + matchesTorrent("ubuntukylin 14.10 beta2 desktop amd64.iso", "1.27 GB", "magnet:?xt=urn:btih:9EDE5CF4F404030251F8319234CE81157D4FE001&dn=ubuntukylin+14+10+beta2+desktop+amd64+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/9EDE5CF4F404030251F8319234CE81157D4FE001.torrent?title=[kat.cr]ubuntukylin.14.10.beta2.desktop.amd64.iso", 1, 0, 0), + matchesTorrent("ubuntukylin 14.10 beta2 desktop i386.iso", "1.28 GB", "magnet:?xt=urn:btih:E97417DB2F25D0FD87F7DF1E7B3B44CE1212F38E&dn=ubuntukylin+14+10+beta2+desktop+i386+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/E97417DB2F25D0FD87F7DF1E7B3B44CE1212F38E.torrent?title=[kat.cr]ubuntukylin.14.10.beta2.desktop.i386.iso", 1, 0, 0), + matchesTorrent("ubuntustudio 14.10 beta2 dvd amd64.iso", "2.06 GB", "magnet:?xt=urn:btih:9230D72299A38213609104661181FE46918B6455&dn=ubuntustudio+14+10+beta2+dvd+amd64+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/9230D72299A38213609104661181FE46918B6455.torrent?title=[kat.cr]ubuntustudio.14.10.beta2.dvd.amd64.iso", 1, 0, 0), + matchesTorrent("Ubuntustudio 14.10 Beta2 i386.iso", "2.19 GB", "magnet:?xt=urn:btih:6C50D760243D02D238726F6A62D6725F667E1AA9&dn=ubuntustudio+14+10+beta2+i386+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/6C50D760243D02D238726F6A62D6725F667E1AA9.torrent?title=[kat.cr]ubuntustudio.14.10.beta2.i386.iso", 1, 0, 0), + matchesTorrent("Ubuntu 14.10 Desktop AMD64.iso", "1.1 GB", "magnet:?xt=urn:btih:18FC1F0208015A23BC08AD3AC5BDD2C46E20E8D0&dn=ubuntu+14+10+desktop+amd64+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/18FC1F0208015A23BC08AD3AC5BDD2C46E20E8D0.torrent?title=[kat.cr]ubuntu.14.10.desktop.amd64.iso", 1, 0, 0), + matchesTorrent("Ubuntu Utopic 14.10 Desktop i386.iso", "1.12 GB", "magnet:?xt=urn:btih:54ADDC06D2DD7BF33DDFA9DB49FEA1A79C990D44&dn=ubuntu+utopic+14+10+desktop+i386+iso&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337", "http://torcache.net/torrent/54ADDC06D2DD7BF33DDFA9DB49FEA1A79C990D44.torrent?title=[kat.cr]ubuntu.utopic.14.10.desktop.i386.iso", 1, 0, 0) )); } diff --git a/src/test/resources/net/pterodactylus/rhynodge/filters/torrents/kickass-to-results.html b/src/test/resources/net/pterodactylus/rhynodge/filters/torrents/kickass-to-results.html index c217968..287346d 100644 --- a/src/test/resources/net/pterodactylus/rhynodge/filters/torrents/kickass-to-results.html +++ b/src/test/resources/net/pterodactylus/rhynodge/filters/torrents/kickass-to-results.html @@ -3,17 +3,18 @@ - + + - Download Ubuntu 14.10 ISO Torrents - KickassTorrents - + Download ubuntu 14.10 iso Torrents - Kickass Torrents + - - - + + @@ -52,12 +64,13 @@
@@ -110,25 +123,24 @@ -

Ubuntu 14.10 ISO results 1-14 from 14

+

ubuntu 14.10 iso results 1-14 from 14

- - - - - + + + + + - - - + + + - - - + + + - - + + - - + + - + - - - + + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + +
torrent namesizefilesageseedleechsizefilesageseedleech
- 1 - - - + 2 + +
@@ -138,22 +150,21 @@ ubuntu 14.10 desktop amd64.iso - Posted by WuffAndre in Applications > Linux + Posted by WuffAndre in Applications > Linux
1.08 GB 12 weeks527 months10
- - - - + + +
@@ -168,17 +179,16 @@
998 MB 12 months419 months20
- - - - + + +
@@ -193,17 +203,16 @@
582 MB 13 months139 months7 0
- - - - + + +
@@ -218,17 +227,16 @@
576 MB 13 months49 months7 0
- - - - + + +
@@ -243,17 +251,16 @@
1.08 GB 13 months10 months 0 0
- 10 - - - + 40 + +
@@ -263,22 +270,21 @@ Ubuntu 14.10 Desktop 32bit ISO - Posted by avgsr in Applications + Posted by avgsr in Applications > Linux
1.11 GB 13 months901310 months8715
- 36 - - - + 115 + +
@@ -288,22 +294,21 @@ Ubuntu 14.10 Desktop 64bit ISO - Posted by avgsr in Applications + Posted by avgsr in Applications > Linux
1.08 GB 13 months2283210 months1508
- - - - + + +
@@ -318,17 +323,16 @@
993 MB 14 months12210 months00
- - - - + + +
@@ -343,17 +347,16 @@
1.27 GB 14 months310 months0 0
- - - - + + +
@@ -368,17 +371,16 @@
1.28 GB 14 months210 months0 0
- - - - + + +
@@ -393,17 +395,16 @@
2.06 GB 14 months210 months0 0
- - - - + + +
@@ -418,17 +419,16 @@
2.19 GB 14 months210 months0 0
- 1 - - - + 1 + +
@@ -443,17 +443,16 @@
1.1 GB 14 months110 months0 0
- - - - + + +
@@ -468,20 +467,21 @@
1.12 GB 14 months210 months0 0
- Search for "Ubuntu 14.10 ISO" on Torrentz.eu + Search for "ubuntu 14.10 iso" on Torrentz.eu
@@ -555,43 +555,43 @@

Latest News

Blogroll

@@ -600,32 +600,32 @@ @@ -633,110 +633,110 @@

Latest Searches