Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
197 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package main | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/gophergala2016/magopie" | ||
) | ||
|
||
var kickAssTorrents = site{ | ||
Site: magopie.Site{ | ||
ID: "kat", | ||
Name: "Kick Ass Torrents", | ||
URL: "https://kat.ph", | ||
Enabled: true, | ||
}, | ||
search: func(term string) ([]magopie.Torrent, error) { | ||
// TODO make http request the pass body to katParse() | ||
return nil, nil | ||
}, | ||
} | ||
|
||
func katParse(r io.Reader) ([]magopie.Torrent, error) { | ||
// TODO implement | ||
return nil, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"reflect" | ||
"testing" | ||
|
||
mp "github.com/gophergala2016/magopie" | ||
) | ||
|
||
func TestKATParse(t *testing.T) { | ||
data, err := os.Open("testdata/kat_ubuntu.xml") | ||
if err != nil { | ||
t.Fatal("Error opening fixture", err) | ||
} | ||
defer data.Close() | ||
|
||
actual, err := katParse(data) | ||
|
||
expected := []mp.Torrent{ | ||
{ | ||
ID: "0C5B427C2F833B09EA0E3DC7C624F6C187125267", | ||
Title: "Ubuntu Linux Go from Beginner to Power User!", | ||
FileURL: "https://torcache.net/torrent/0C5B427C2F833B09EA0E3DC7C624F6C187125267.torrent?title=[kat.cr]ubuntu.linux.go.from.beginner.to.power.user", | ||
SiteID: "kat", | ||
Size: 1137244499, | ||
Seeders: 85, | ||
Leechers: 105, | ||
}, | ||
{ | ||
ID: "21236117B7A773639BD5C7C771E66A045BD51A8A", | ||
Title: "Learning Ubuntu Linux Server", | ||
FileURL: "https://torcache.net/torrent/21236117B7A773639BD5C7C771E66A045BD51A8A.torrent?title=[kat.cr]learning.ubuntu.linux.server", | ||
SiteID: "kat", | ||
Size: 581653341, | ||
Seeders: 48, | ||
Leechers: 12, | ||
}, | ||
{ | ||
ID: "13DBA979D53F20E6A73D4EE939952D1C367B64C7", | ||
Title: "CodeWeavers Crossover 15.0.1 with crack for ubuntu fedora linux", | ||
FileURL: "https://torcache.net/torrent/13DBA979D53F20E6A73D4EE939952D1C367B64C7.torrent?title=[kat.cr]codeweavers.crossover.15.0.1.with.crack.for.ubuntu.fedora.linux", | ||
SiteID: "kat", | ||
Size: 240330669, | ||
Seeders: 1, | ||
Leechers: 1, | ||
}, | ||
{ | ||
ID: "EB7B040141407F150E32FF366CD624403387B5C1", | ||
Title: "Ubuntu 16.04 (Xenial Xerus) Alpha Desktop AMD64 (64-bit PC)", | ||
FileURL: "https://torcache.net/torrent/EB7B040141407F150E32FF366CD624403387B5C1.torrent?title=[kat.cr]ubuntu.16.04.xenial.xerus.alpha.desktop.amd64.64.bit.pc", | ||
SiteID: "kat", | ||
Size: 1480048640, | ||
Seeders: 1, | ||
Leechers: 3, | ||
}, | ||
} | ||
|
||
if !reflect.DeepEqual(actual, expected) { | ||
t.Errorf("tpbParse actual = %v\nexpected %v", actual, expected) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<rss version="2.0" xmlns:torrent="//kastatic.com/xmlns/0.1/"> | ||
<channel> | ||
<title>Torrents by keyword "ubuntu" - KickassTorrents</title> | ||
<link>http://kat.cr/</link> | ||
<description>Torrents by keyword "ubuntu"</description> | ||
<item> | ||
<title>Ubuntu Linux Go from Beginner to Power User!</title> | ||
|
||
<category>Other - Tutorials</category> | ||
<author>http://kat.cr/user/trancedude/</author> | ||
<link>http://kat.cr/ubuntu-linux-go-from-beginner-to-power-user-t11946299.html</link> | ||
<guid>http://kat.cr/ubuntu-linux-go-from-beginner-to-power-user-t11946299.html</guid> | ||
<pubDate>Fri, 22 Jan 2016 12:01:18 +0000</pubDate> | ||
<torrent:contentLength>1137244499</torrent:contentLength> | ||
<torrent:infoHash>0C5B427C2F833B09EA0E3DC7C624F6C187125267</torrent:infoHash> | ||
<torrent:magnetURI><![CDATA[magnet:?xt=urn:btih:0C5B427C2F833B09EA0E3DC7C624F6C187125267&dn=ubuntu+linux+go+from+beginner+to+power+user&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fglotorrents.pw%3A6969%2Fannounce]]></torrent:magnetURI> | ||
<torrent:seeds>85</torrent:seeds> | ||
<torrent:peers>190</torrent:peers> | ||
<torrent:verified>1</torrent:verified> | ||
<torrent:fileName>ubuntu.linux.go.from.beginner.to.power.user.torrent</torrent:fileName> | ||
<enclosure url="https://torcache.net/torrent/0C5B427C2F833B09EA0E3DC7C624F6C187125267.torrent?title=[kat.cr]ubuntu.linux.go.from.beginner.to.power.user" length="1137244499" type="application/x-bittorrent" /> | ||
</item> | ||
<item> | ||
<title>Learning Ubuntu Linux Server</title> | ||
|
||
<category>Other - Tutorials</category> | ||
<author>http://kat.cr/user/trancedude/</author> | ||
<link>http://kat.cr/learning-ubuntu-linux-server-t11925363.html</link> | ||
<guid>http://kat.cr/learning-ubuntu-linux-server-t11925363.html</guid> | ||
<pubDate>Mon, 18 Jan 2016 14:41:29 +0000</pubDate> | ||
<torrent:contentLength>581653341</torrent:contentLength> | ||
<torrent:infoHash>21236117B7A773639BD5C7C771E66A045BD51A8A</torrent:infoHash> | ||
<torrent:magnetURI><![CDATA[magnet:?xt=urn:btih:21236117B7A773639BD5C7C771E66A045BD51A8A&dn=learning+ubuntu+linux+server&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fglotorrents.pw%3A6969%2Fannounce]]></torrent:magnetURI> | ||
<torrent:seeds>48</torrent:seeds> | ||
<torrent:peers>60</torrent:peers> | ||
<torrent:verified>1</torrent:verified> | ||
<torrent:fileName>learning.ubuntu.linux.server.torrent</torrent:fileName> | ||
<enclosure url="https://torcache.net/torrent/21236117B7A773639BD5C7C771E66A045BD51A8A.torrent?title=[kat.cr]learning.ubuntu.linux.server" length="581653341" type="application/x-bittorrent" /> | ||
</item> | ||
<item> | ||
<title>CodeWeavers Crossover 15.0.1 with crack for ubuntu fedora linux</title> | ||
|
||
<category>Applications - Linux</category> | ||
<author>http://kat.cr/user/dawnchou/</author> | ||
<link>http://kat.cr/codeweavers-crossover-15-0-1-with-crack-for-ubuntu-fedora-linux-t11906286.html</link> | ||
<guid>http://kat.cr/codeweavers-crossover-15-0-1-with-crack-for-ubuntu-fedora-linux-t11906286.html</guid> | ||
<pubDate>Thu, 14 Jan 2016 21:40:33 +0000</pubDate> | ||
<torrent:contentLength>240330669</torrent:contentLength> | ||
<torrent:infoHash>13DBA979D53F20E6A73D4EE939952D1C367B64C7</torrent:infoHash> | ||
<torrent:magnetURI><![CDATA[magnet:?xt=urn:btih:13DBA979D53F20E6A73D4EE939952D1C367B64C7&dn=codeweavers+crossover+15+0+1+with+crack+for+ubuntu+fedora+linux&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fglotorrents.pw%3A6969%2Fannounce]]></torrent:magnetURI> | ||
<torrent:seeds>1</torrent:seeds> | ||
<torrent:peers>2</torrent:peers> | ||
<torrent:verified>0</torrent:verified> | ||
<torrent:fileName>codeweavers.crossover.15.0.1.with.crack.for.ubuntu.fedora.linux.torrent</torrent:fileName> | ||
<enclosure url="https://torcache.net/torrent/13DBA979D53F20E6A73D4EE939952D1C367B64C7.torrent?title=[kat.cr]codeweavers.crossover.15.0.1.with.crack.for.ubuntu.fedora.linux" length="240330669" type="application/x-bittorrent" /> | ||
</item> | ||
<item> | ||
<title>Ubuntu 16.04 (Xenial Xerus) Alpha Desktop AMD64 (64-bit PC)</title> | ||
|
||
<category>Applications - Linux</category> | ||
<author>http://kat.cr/user/hun7er/</author> <link>http://kat.cr/ubuntu-16-04-xenial-xerus-alpha-desktop-amd64-64-bit-pc-t11905044.html</link> | ||
<guid>http://kat.cr/ubuntu-16-04-xenial-xerus-alpha-desktop-amd64-64-bit-pc-t11905044.html</guid> | ||
<pubDate>Thu, 14 Jan 2016 16:33:46 +0000</pubDate> | ||
<torrent:contentLength>1480048640</torrent:contentLength> | ||
<torrent:infoHash>EB7B040141407F150E32FF366CD624403387B5C1</torrent:infoHash> | ||
<torrent:magnetURI><![CDATA[magnet:?xt=urn:btih:EB7B040141407F150E32FF366CD624403387B5C1&dn=ubuntu+16+04+xenial+xerus+alpha+desktop+amd64+64+bit+pc&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fglotorrents.pw%3A6969%2Fannounce]]></torrent:magnetURI> | ||
<torrent:seeds>1</torrent:seeds> | ||
<torrent:peers>4</torrent:peers> | ||
<torrent:verified>0</torrent:verified> | ||
<torrent:fileName>ubuntu.16.04.xenial.xerus.alpha.desktop.amd64.64.bit.pc.torrent</torrent:fileName> | ||
<enclosure url="https://torcache.net/torrent/EB7B040141407F150E32FF366CD624403387B5C1.torrent?title=[kat.cr]ubuntu.16.04.xenial.xerus.alpha.desktop.amd64.64.bit.pc" length="1480048640" type="application/x-bittorrent" /> | ||
</item> | ||
</channel> | ||
</rss> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters