kennedyoliveira / pastebin4j

Paste bin API Wrapper for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting paste content throws an exception

BullyWiiPlaza opened this issue · comments

I'm using the following code:

import com.github.kennedyoliveira.pastebin4j.AccountCredentials;
import com.github.kennedyoliveira.pastebin4j.Paste;
import com.github.kennedyoliveira.pastebin4j.PasteBin;

public class PasteBin4JWrapper
{
	// Configuration for the Credentials
	private static final String devKey = "dev-key";
	private static final String userName = "user-name";
	private static final String password = "password";

	private static final AccountCredentials ACCOUNT_CREDENTIALS = new AccountCredentials(devKey, userName, password);

	// Create a PasteBin object with the credentials
	private static final PasteBin pasteBin = new PasteBin(ACCOUNT_CREDENTIALS);

	public static String getPaste(String pasteKey)
	{
		Paste paste = new Paste(pasteKey);
		return pasteBin.getPasteContent(paste);
	}
}

And calling it with a valid pasteKey gives me the following exception:

java.lang.RuntimeException: Error posting to https://pastebin.com/raw.php using the params: null
	at com.github.kennedyoliveira.pastebin4j.api.WebUtils.doRequest(WebUtils.java:106)
	at com.github.kennedyoliveira.pastebin4j.api.WebUtils.get(WebUtils.java:58)
	at com.github.kennedyoliveira.pastebin4j.api.PasteBinApiImpl.getPasteContent(PasteBinApiImpl.java:213)
	at com.github.kennedyoliveira.pastebin4j.api.PasteBinApiImpl.getPasteContent(PasteBinApiImpl.java:228)
	at com.github.kennedyoliveira.pastebin4j.PasteBin.getPasteContent(PasteBin.java:139)
	at com.bullywiihacks.utilities.application.downloader.PasteBin4JWrapper.getPaste(PasteBin4JWrapper.java:29)

The response code is 301 which means Moved Permanently.

Any ideas or plans on fixing this? Maybe the Pastebin API has changed respectively.