forked from jpillora/cloud-torrent
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
search kinda working, torrents displaying - not downloading yet
- Loading branch information
Showing
42 changed files
with
1,669 additions
and
931 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,21 +1,26 @@ | ||
package ct | ||
package engine | ||
|
||
import "github.com/jpillora/cloud-torrent/ct/shared" | ||
import "github.com/jpillora/cloud-torrent/ct/engines/native" | ||
|
||
type engineID string | ||
type ID string | ||
|
||
//the common engine interface | ||
type Engine interface { | ||
Name() string //name (lower(name)->id) | ||
NewConfig() interface{} //*Config object | ||
SetConfig() error | ||
SetConfig(interface{}) error | ||
Magnet(uri string) error | ||
List() ([]*shared.Torrent, error) //get a list of all Torrents | ||
Fetch(*shared.Torrent) error //fetch the Files of a particular Torrent | ||
Torrents() <-chan *shared.Torrent | ||
} | ||
|
||
//TODO engines which require polling | ||
type EnginePoller interface { | ||
Poll() error | ||
PollTorrent(*shared.Torrent) error | ||
} | ||
|
||
//insert each of the cloud-torrent bundled engines | ||
var bundledEngines = []Engine{ | ||
var Bundled = []Engine{ | ||
&native.Native{}, | ||
} |
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,58 @@ | ||
package ct | ||
|
||
var defaultSearchConfig = []byte(`{ | ||
"google": { | ||
"name": "Google Search", | ||
"url": "https://www.google.com/search?q={{q}}", | ||
"list": "#search ol > li", | ||
"result": { | ||
"title": "li > h3 a", | ||
"url": ["li > h3 a", "@href", "/^\\/url\\?q=([^&]+)/"] | ||
} | ||
}, | ||
"kat": { | ||
"name": "Kickass Torrents", | ||
"url": "https://kat.cr/usearch/{{query}}/{{page:1}}/?field=seeders&sorder=desc", | ||
"list": "#mainSearchTable table tr[id]", | ||
"result": { | ||
"name":".cellMainLink", | ||
"url":[".cellMainLink", "@href"], | ||
"magnet": ["a[title=Torrent\\ magnet\\ link]", "@href"], | ||
"size": "td.nobr.center", | ||
"seeds": ".green.center", | ||
"peers": ".red.center" | ||
} | ||
}, | ||
"tpb": { | ||
"name": "The Pirate Bay", | ||
"url": "https://thepiratebay.se/search/{{query}}/{{page:0}}/7//", | ||
"list": "#searchResult > tbody > tr", | ||
"result": { | ||
"name":"a.detLink", | ||
"url":["a.detLink","@href"], | ||
"magnet": ["a[title=Download\\ this\\ torrent\\ using\\ magnet]","@href"], | ||
"size": "/Size (\\d+(\\.\\d+).[KMG]iB)/", | ||
"seeds": "td:nth-child(3)", | ||
"peers": "td:nth-child(4)" | ||
} | ||
}, | ||
"abb": { | ||
"name": "The Audiobook Bay", | ||
"url": "http://audiobookbay.co/page/{{page:1}}?s={{query}}", | ||
"list": "#content > div", | ||
"result": { | ||
"name":["div.postTitle > h2 > a","@title"], | ||
"path":["div.postTitle > h2 > a","@href"], | ||
"seeds": "div.postContent > p:nth-child(3) > span:nth-child(1)", | ||
"peers": "div.postContent > p:nth-child(3) > span:nth-child(3)" | ||
} | ||
}, | ||
"abb-item": { | ||
"name": "The Audiobook Bay (Item)", | ||
"url": "http://audiobookbay.co/{{path}}", | ||
"result": { | ||
"infohash": "/td>([a-f0-9]+)</", | ||
"tracker": "table tr:nth-child(1) > td:nth-child(2)" | ||
} | ||
} | ||
}`) |
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
Oops, something went wrong.