Blog Pile

Yet Another Flickr CC Attribution Helper Update


cc licensed ( BY NC SA ) flickr photo shared by sn0wcrash

I had to make another tiny update to my flickr cc attribution helper script, more or less fixing my own goofs. The thing that was happening was the attribution was not appearing on your own photos (if you were logged into flickr), but you would see it on other creative commons licensed images… this only about 10 days after the last update.

I saw it myself- my own short term fix was to open a web browser where I was not logged into flickr.

If you want some details, scroll on other wise, get the new scripts (still on the burner is to enable the Chrome one to be updated, for now you have to delete it an re-install) (see what a lousy coder I am?).

The way these work is that your browser invokes them only on pages from flickr.com. It uses something known as XML Path Language (XPath) to find certainly elements in the web page structure. It figures out if the flickr page is even creative commons licensed by looking for a particular span element that flickr uses to wrap the little icons:

or the exact code:

It then does a few gymnastics to assemble the attribution code embedded in a textarea box.

Now the tricky part was finding where to insert that in the page when the script modifies the output. It needs to find a specific div and than append the HTML for the attribution after it.

What I had done on the last update was find two possible places- there was one div and class used when it is for someone else’s page, and a difference div and class when it is your own photo. It’s tricky, because when flickr decides to make a change to their output, it can break my script.

And this recent break is as simple as on your own photos, it seemed to have added an extraneous space in a class name- it should be:

but sometime in the last few days, someone slipped on their template add the class name had an extra space

They will likely fix this, so I retreated, and instead of trying to find the two different divs, I was able to hang the output after the div for the entire right side sidebar (I thought I had tried this before, but it seemed to work today).

If I was better I would code it as some sort of overlay or interface that slides in from the side. I really do not want to have to tweak the code each time flickr tweaks their templates for output.

I have to say, these fixes are easier to test and check in Firefox. I can locate the script inside my preference files, make changes, and they are reflected when the page is reloaded. Chrome is a bit more obtuse.

I am hard core dedicated to keeping the attribution tools afloat.

And as a bit of curious, I wonder if it is a bit of code humor or a typo/mispelling that the div id for the sidebar is named sidecar.

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for CogDog The Blog
An early 90s builder of web stuff and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as @cogdog@cosocial.ca

Leave a Reply

Your email address will not be published. Required fields are marked *