'How do you get a kik profile picture for a given profile name?
I'm trying to find a way I can get the URL for an image from a person's kik username. This user will provide their username. I want to run this on an iPhone so ideally a restful request would be best. But I've not seen any restful API for kik.
Solution 1:[1]
Hope it helps you......
http://cdn.kik.com/user/pic/[USERNAME]
Solution 2:[2]
Since the accepted answer is not outdated you can get the profile picture URL using
https://ws2.kik.com/user/USERNAME
e.g. https://ws2.kik.com/user/KikTeam
This returns a JSON Response
{"firstName":"Kik","lastName":"Team","displayPicLastModified":1531418402837,"displayPic":"http:\/\/profilepics.cf.kik.com\/9wG3zRZW8sLxLnpmyOfwNE7ChYk\/orig.jpg"}
displayPic
is the URL to the profile picture. Here is a Java Method I wrote to parse the response.
public static void getInformation(String username){
String API = "https://ws2.kik.com/user/";
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(API + username).openConnection().getInputStream(), StandardCharsets.UTF_8))) {
String response = reader.lines().collect(Collectors.joining("\n"));
JSONObject jsonObject = new JSONObject(response);
String firstName = jsonObject.getString("firstName");
String lastName = jsonObject.getString("lastName");
long displayPicLastModified = jsonObject.getLong("displayPicLastModified");
String displayPic = jsonObject.getString("displayPic");
System.out.printf("firstName: %s, lastName: %s, displayPicLastModified: %d, displayPic: %s\n",
firstName, lastName, displayPicLastModified, displayPic);
} catch (IOException | JSONException e) {
e.printStackTrace();
}
}
Now lets call it by using
getInformation("KikTeam");
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Arvin |
Solution 2 | SamHoque |