public PhotoList < Photo > searchInterestingness ( SearchParameters params , int perPage , int page ) throws FlickrException { PhotoList < Photo > photos = new PhotoList < Photo > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_INTERESTINGNESS ) ; parameters . putAll ( params . getAsParameters ( ) ) ; if ( perPage > 0 ) { parameters . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { parameters . put ( "page" , Integer . toString ( page ) ) ; } Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element photosElement = response . getPayload ( ) ; photos . setPage ( photosElement . getAttribute ( "page" ) ) ; photos . setPages ( photosElement . getAttribute ( "pages" ) ) ; photos . setPerPage ( photosElement . getAttribute ( "perpage" ) ) ; photos . setTotal ( photosElement . getAttribute ( "total" ) ) ; NodeList photoNodes = photosElement . getElementsByTagName ( "photo" ) ; for ( int i = 0 ; i < photoNodes . getLength ( ) ; i ++ ) { Element photoElement = ( Element ) photoNodes . item ( i ) ; Photo photo = new Photo ( ) ; photo . setId ( photoElement . getAttribute ( "id" ) ) ; User owner = new User ( ) ; owner . setId ( photoElement . getAttribute ( "owner" ) ) ; photo . setOwner ( owner ) ; photo . setSecret ( photoElement . getAttribute ( "secret" ) ) ; photo . setServer ( photoElement . getAttribute ( "server" ) ) ; photo . setFarm ( photoElement . getAttribute ( "farm" ) ) ; photo . setTitle ( photoElement . getAttribute ( "title" ) ) ; photo . setPublicFlag ( "1" . equals ( photoElement . getAttribute ( "ispublic" ) ) ) ; photo . setFriendFlag ( "1" . equals ( photoElement . getAttribute ( "isfriend" ) ) ) ; photo . setFamilyFlag ( "1" . equals ( photoElement . getAttribute ( "isfamily" ) ) ) ; photos . add ( photo ) ; } return photos ; }
Search for interesting photos using the Flickr Interestingness algorithm .