diff --git a/src/com/reverb/api/HttpRequest.java b/src/com/reverb/api/HttpRequest.java index b5dc101..d8a289f 100644 --- a/src/com/reverb/api/HttpRequest.java +++ b/src/com/reverb/api/HttpRequest.java @@ -273,7 +273,6 @@ public byte[] sendRaw(byte[] content) throws IOException { if(METHOD_GET.equals(method)){ baseurl = baseurl + (content !=null && content.length > 0 ? (baseurl.indexOf('?') < 0 ? '?' : '&') + new String(content) : ""); } - ReverbApi.echo(baseurl); conn = (HttpURLConnection) new URL(baseurl).openConnection(); conn.setRequestMethod(method); for (Map.Entry header : headers.entrySet()) { diff --git a/src/com/reverb/api/ReverbAffiliates.java b/src/com/reverb/api/ReverbAffiliates.java index 8abda58..b88752a 100644 --- a/src/com/reverb/api/ReverbAffiliates.java +++ b/src/com/reverb/api/ReverbAffiliates.java @@ -8,15 +8,17 @@ public class ReverbAffiliates { public static final String HORIZONAL = "horizontal"; public static final String VERTICAL = "vertical"; - public static String comparisonEmbed(JSONObject json, boolean horizontal, String affiliateid) { - //Check if json is a result or + public static String comparisonLink(JSONObject json) { JSONObject item = ReverbApi.getFirstItem(json, ReverbApi.COMPARISON_SHOPPING_PAGES); JSONObject links = item.optJSONObject(ReverbApi.LINKS); JSONObject web = links.optJSONObject(ReverbApi.WEB); - return comparisonEmbed(web.optString(ReverbApi.HREF), horizontal, affiliateid); + return web.optString(ReverbApi.HREF); + } + public static String comparisonEmbed(JSONObject json, boolean horizontal, String affiliateid) { + return comparisonEmbed(comparisonLink(json), horizontal, affiliateid); } public static String comparisonEmbed(String weburl, boolean horizontal, String affiliateid) { - // + // //?_aid=geartube&orientation=horizontal String suffix = weburl.substring(weburl.lastIndexOf('/')+1); return affiliateLink(ReverbApi.URL+"/affiliates/comparison_shopping_embeds/"+suffix+"?orientation="+(horizontal?HORIZONAL:VERTICAL), affiliateid);