Skip to content

Instantly share code, notes, and snippets.

@wakawaka54
Created February 25, 2019 19:26
Show Gist options
  • Save wakawaka54/23b4d1cb352686cd99c40a8cdf3f6f86 to your computer and use it in GitHub Desktop.
Save wakawaka54/23b4d1cb352686cd99c40a8cdf3f6f86 to your computer and use it in GitHub Desktop.
Dynamic AliExpress Affiliate Link
@Slf4j
public class AffiliateInformationProvider {
private final static String AFFILIATE_BASE_URL = "http://s.click.aliexpress.com/deep_link.htm";
private final static String AFFILIATE_SHORT_KEY = "YOUR_SHORT_KEY";
public String getAffiliateUrl(String detailUrl) {
URL url = UrlBuilder.fromString(AFFILIATE_BASE_URL)
.addParameter("dl_target_url", detailUrl)
.addParameter("aff_short_key", AFFILIATE_SHORT_KEY)
.toUrl();
return url.toExternalForm();
}
}
@Poissac9
Copy link

Hey, can you tell me how where i can find short key ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment