@@ -150,15 +150,41 @@ public Group lookupGroup(String url) throws FlickrException {
150150 return group ;
151151 }
152152
153+ /**
154+ * Lookup the username for the specified User URL.
155+ *
156+ * @param url
157+ * The user profile URL
158+ * @return The username
159+ * @throws FlickrException if there was a problem connecting to Flickr
160+ */
161+ public String lookupUsernameByURL (String url ) throws FlickrException {
162+ return lookupUserByURL (url ).getUsername ();
163+ }
164+
153165 /**
154166 * Lookup the username for the specified User URL.
155167 *
156168 * @param url
157169 * The user profile URL
158170 * @return The username
159171 * @throws FlickrException if there was a problem connecting to Flickr
172+ * @deprecated use {@link #lookupUsernameByURL(String) }
160173 */
174+ @ Deprecated
161175 public String lookupUser (String url ) throws FlickrException {
176+ return lookupUsernameByURL (url );
177+ }
178+
179+ /**
180+ * Lookup the user for the specified User URL.
181+ *
182+ * @param url
183+ * The user profile URL
184+ * @return The user
185+ * @throws FlickrException if there was a problem connecting to Flickr
186+ */
187+ public User lookupUserByURL (String url ) throws FlickrException {
162188 Map <String , Object > parameters = new HashMap <String , Object >();
163189 parameters .put ("method" , METHOD_LOOKUP_USER );
164190
@@ -171,7 +197,10 @@ public String lookupUser(String url) throws FlickrException {
171197
172198 Element payload = response .getPayload ();
173199 Element groupnameElement = (Element ) payload .getElementsByTagName ("username" ).item (0 );
174- return ((Text ) groupnameElement .getFirstChild ()).getData ();
200+ User user = new User ();
201+ user .setId (payload .getAttribute ("id" ));
202+ user .setUsername (((Text ) groupnameElement .getFirstChild ()).getData ());
203+ return user ;
175204 }
176205
177206 /**
0 commit comments