Skip to content

Commit

Permalink
Update rarbg api (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
lightglitch authored and erickok committed Apr 3, 2018
1 parent a7cd616 commit 15847a1
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -31,7 +31,7 @@
*/
public class RarbgAdapter implements ISearchAdapter {

private static final String BASE_URL = "https://torrentapi.org/pubapi_v2.php";
private static final String BASE_URL = "https://torrentapi.org/pubapi_v2.php?app_id=transdroid";

// Access is provided using a token, requested via get_token and valid for up to 15 minutes
private static String accessToken;
Expand Down Expand Up @@ -79,7 +79,7 @@ public List<SearchResult> search(SharedPreferences prefs, String query, SortOrde
private void requestAccessToken() throws Exception {

// Ask for a new token
HttpResponse response = httpclient.execute(new HttpGet(BASE_URL + "?get_token=get_token"));
HttpResponse response = httpclient.execute(new HttpGet(BASE_URL + "&get_token=get_token"));
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
InputStream instream = response.getEntity().getContent();
String error = HttpHelper.convertStreamToString(instream);
Expand All @@ -106,7 +106,7 @@ private void requestAccessToken() throws Exception {
private List<SearchResult> performSearch(String query, SortOrder order) throws Exception {

// Ask for extended search results
String q = String.format(Locale.US, "?mode=search&search_string=%1$s&ranked=0&sort=%2$s&format=json_extended&token=%3$s",
String q = String.format(Locale.US, "&mode=search&search_string=%1$s&ranked=0&sort=%2$s&format=json_extended&token=%3$s",
URLEncoder.encode(query, "UTF-8"), (order == SortOrder.BySeeders ? "seeders" : "last"), accessToken);
HttpResponse response = httpclient.execute(new HttpGet(BASE_URL + q));

Expand Down

0 comments on commit 15847a1

Please sign in to comment.