I'm not longer maintaining this project due to time constraints.
An Android library for querying magnets from thepiratebay.org.
When a query is started, the library attempts to query against all defined hosts simultaneously until an endpoint successfully returns a QueryResult containing TorrentResult instances. When this happens, all pending queries are cancelled. A request to an endpoint will timeout after the defined requestTimeoutMs
. The query as a whole will timeout after the defined queryTimeoutMs
.
Please see the companion demo application of this library for a detailed example of how to use this library alongside the Android JetPack Paging library.
Simply invoke QueryService.query(..)
to query for magnets. For example, to query for The Hobbit from 1977 the first page of results with a query timeout of 10,000 milliseconds, a timeout per site of 5,000 milliseconds, and a maximum successful response count of 5, one would do the following:
val queryService: QuerySerivce = QueryService(
queryFactories = QueryFactories
)
...
launch() {
val queryResult = queryService.query(
query = "The Hobbit 1977"
, pageIndex = 0
, queryTimeout = 10000L
, requestTimeout = 5000
): QueryResult<TorrentResult>
}
Add this in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
and add the following in the dependent module:
dependencies {
implementation 'com.github.masterwok:tpb-search-android:0.0.3'
}