Advertisement
Guest User

Untitled

a guest
May 25th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. private String resolvePhotoUrl(Result result) {
  2.  
  3.     if (result.getAuthorUrl() == null) {
  4.  
  5.         return null;
  6.     }
  7.  
  8.     if (result.getAuthorUrl().startsWith("http://www.facebook.com")) {
  9.  
  10.         String chunks[] = result.getAuthorUrl().split("id=");
  11.         String profileId = chunks[chunks.length - 1];
  12.         return "https://graph.facebook.com/" + profileId + "/picture?type=small";
  13.     }
  14.  
  15.     if (result.getAuthorUrl().startsWith("http://instagram.com")) {
  16.  
  17.         return "https://avatars.io/instagram/" + result.getAuthor();
  18.     }
  19.  
  20.     if (result.getAuthorUrl().startsWith("http://twitter.com")) {
  21.  
  22.         return "https://twitter.com/" + result.getAuthor() + "/profile_image?size=bigger";
  23.     }
  24.  
  25.     return null;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement