The Flickr service API doesn’t seem to have the getfavorites() request implemented. Is there an good way to do this with WebExecute?

Code to get started with:

For a given user, say 7944912@N05, there are n pages for which one can manually extract images:

s = StartWebSession[];

 "OpenPage" -> 

possibleimageurls = WebExecute[s, "PageHyperlinks"];

i = Import@
{Thumbnail@i, ImageDimensions[i]}

enter image description here

But I don't know how to enumerate the highest resolution ones.

  • 2
    $\begingroup$ Easier is probably to patch the ServiceConnect paclet to add the request. That on its own isn't too hard. Just find the paclet with PacletFind and figure out where they implement all their requests. $\endgroup$ – b3m2a1 Sep 12 '19 at 4:58
  • 1
    $\begingroup$ Open the paclet with PacletFind["ServiceConnect_Flickr"]["Location"]. There’ll be a Kernel folder. Inside that there should be like Flickr.m or something. That’s where all the API requests are implemented. $\endgroup$ – b3m2a1 Sep 20 '19 at 21:29
  • 2
    $\begingroup$ I wrote up a Q/A about how to work with service connect packets here a few years back $\endgroup$ – b3m2a1 Sep 20 '19 at 21:29
  • 1
    $\begingroup$ @b3m2a1 Thanks, but PacletFind["ServiceConnect_Flickr"] gives {}, is there a link to your tutorial? $\endgroup$ – M.R. Sep 20 '19 at 21:35
  • 1
    $\begingroup$ @b3m2a1 Would you be able to point me to your tutorial? $\endgroup$ – M.R. Sep 23 '19 at 19:12

This is not a full answer

As @b3m2a1 suggested, I looked into the paclet and tried updating the functions:

p = PacletFind["Service*_*Fl*"]

enter image description here

Which looks like this:

enter image description here

Then I added this to Flickr.m:

 flickrdata["RawFaves"] := {
    "URL"                -> "https://api.flickr.com/services/rest?method=flickr.favorites.getlist",
    "HTTPSMethod"        -> "GET",
    "Parameters"        -> {"user_id","tags","tag_mode","text","min_upload_date","max_upload_date",
    "RequiredParameters"-> {},
    "ReturnContentData" -> True,
    "ResultsFunction"    -> flickrimport

Then I restarted the kernel, configure the connection again (which there was a way to save between restarts):

f = ServiceConnect["Flickr"]

and tried it out:

results = 
 f["RawFaves", "user_id" -> "97408942@N04", "per_page" -> "2", 
  "page" -> "1", "format" -> "json", "nojsoncallback" -> "1"]

enter image description here

Q: How do I get it to return the original sized images?

| improve this answer | |
  • $\begingroup$ @b3m2a1 PacletUpdate is now obsolete, and this stopped working in v12.1... any ideas? $\endgroup$ – M.R. May 26 at 1:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.