Thanks! Ya I'm just using static country parameters so that will hopefully help... Also I didn't know if they were maybe trying to filter out IPs from mobile devices since I have no issues when using WiFi (although the country parameters I'm using are what I got with an Http Sniffer from my home network)... Here's my song search function... Sorry the code is a bit crude right now...
Code:
static Object GSAPI_songSearch(String SongSearch) {
String url = "http://cowbell.grooveshark.com/more.php?getSearchResultsEx";
String ret_string="";
JSONObject JSONHeaders = new JSONObject();
JSONObject JSONParameters = new JSONObject();
JSONObject JSONCountry = new JSONObject();
JSONObject JSONMainObj = new JSONObject();
JSONArray jsonArray = null;
StringEntity se;
HttpResponse response = null;
String resultString = null;
String temptoken = GSAPI_getRequestToken("getSearchResultsEx");
try {
JSONCountry.put("CC1", "0");
JSONCountry.put("CC2", "0");
JSONCountry.put("CC3", "0");
JSONCountry.put("CC4", "0");
JSONCountry.put("ID", "1");
JSONHeaders.put("session", SessionID);
JSONHeaders.put("uuid", UserID);
JSONHeaders.put("client", "gslite");
JSONHeaders.put("clientRevision", clientRev);
JSONHeaders.put("token", temptoken);
JSONHeaders.put("privacy", "1");
JSONHeaders.put("country", JSONCountry);
JSONParameters.put("query", SongSearch.toLowerCase());
JSONParameters.put("type", "Songs");
JSONMainObj.put("method", "getSearchResultsEx");
JSONMainObj.put("parameters", JSONParameters);
JSONMainObj.put("header", JSONHeaders);
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpPostRequest = new HttpPost(url);
se = new StringEntity(JSONMainObj.toString());
httpPostRequest.setEntity(se);
httpPostRequest.setHeader("User-Agent",header_user_agent);
httpPostRequest.setHeader("content-type", header_content_json);
httpPostRequest.setHeader("Accept",header_accept_1);
httpPostRequest.setHeader("Accept-Language",header_accept_language);
httpPostRequest.removeHeaders("Expect");
response = (HttpResponse) httpclient.execute(httpPostRequest);
if(response.getStatusLine().getStatusCode()==200){
HttpEntity entity = response.getEntity();
if (entity != null) {
// Read the content stream
InputStream instream = entity.getContent();
// convert content stream to a String
resultString = convertStreamToString(instream);
instream.close();
if(resultString.charAt(0)=='{'){
JSONObject jsonObjRecv = new JSONObject(resultString);
JSONObject tempObj =jsonObjRecv.getJSONObject("result");
CharSequence cs = "[{";
if(!tempObj.toString().contains(cs)){
ret_string="Search broken in zeros";
JSONObject tempObj2=tempObj.getJSONObject("result");
jsonArray=new JSONArray();
for(int i=0;i<(tempObj2.length()-2);i++){
jsonArray.put(tempObj2.get(String.valueOf(i)));
}
}else{
ret_string="Search broken in array";
jsonArray = tempObj.getJSONArray("result");
}
}else{
ret_string=resultString;
}
}
}else{
ret_string = "Error code: " + String.valueOf(response.getStatusLine().getStatusCode())+ " " + response.getStatusLine().getReasonPhrase();
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(!(jsonArray==null)){
return jsonArray;
}else{
return ret_string;
}
}
With these headers:
Code:
static String clientRev = "20100412.29";
static String weirdString = ":quitStealinMahShit:";
static String header_user_agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1064 Safari/532.5";
static String header_content_json="application/json";
static String header_content_url="application/x-www-form-urlencoded";
static String header_accept_1="*/*";
static String header_accept_language="en-US";
Thanks again for your help!!