Discussies » Ontwikkeling

Signing a Flickr api-call from a userscript? (...being the browser user)

§
Geplaatst: 20-08-2015
Bijgewerkt: 20-08-2015

Signing a Flickr api-call from a userscript? (...being the browser user)

Hi hackers

I'm making my first greasemonkey userscript, and has stumbled into a little problem...

It is a multi feature userscript for Flickr, and one of the features is to build a column of a photographer's albums to be shown to the right of the photographer's photostream. I currently get the album-list by calling the api method flickr.photosets.getList, and like the other api-calls I make in the script, I do the call unsigned.

This works fine in most cases, but then I stumbled on a photographer (some photos NSFW) where I don't get any albums calling this method, even though the photographer has several albums to be found on her Albums page. As I looked deeper into it, I realized it is because she has all her photos set to have safety-level Restricted, and thus requiring the viewer to be logged in as a user having SafeSearch turned off (or set to moderate?) in Flickr's user-settings.

However my userscript is of course running in the browser and "context" of some user likely already logged into Flickr. Can I somehow easy take advantage of this and call the api as the user already being logged into Flickr?

I know, the alternative to their webservice, could be to instead read the content of the photographer's "real" album-page using XMLHttpRequest, and parse the html to find the photographer's albums. Maybe that's the easiest solution, but I think it would be more elegant to use a stable api - if possible. Reading a webpage would make me more sensitive to site-changes.

I hope I made myself understandable :-) ...

The script is not published yet but will be available through Greasy Fork when ready. Still need some testing and "optimizations" like above.

Reactie plaatsen

Log in om antwoord te geven.