Morton Fox (mortonfox) wrote,
Morton Fox
mortonfox

Flickr scripting Friday

West Lake

While scripting Flickr, one revelation just led to another and another and so on. Yesterday, I figured out why the script wasn't seeing all of the group pool. Some users were posting non-public photos to the pool. As admin, I see those, of course, but the script wasn't getting them in the photo list. The reason? I didn't add the authentication token correctly. Okay, so I fixed that. The script still wasn't retrieving those photo pages! (In order to get the view counts, of course. Nothing evil there. However, people really should not be posting non-public photos to groups. What's the point in doing that anyway? Aren't they aware that all the admins can see those photos?) The reason for that was pretty obvious. The script's user agent hasn't logged in.

As I was searching the web for a good way to do that, hopefully a script where someone else had already done the work, I came across WWW::Mechanize. This is one amazing module! In just a few lines of code, I had the script fill in the Flickr login form, submit it, and follow the redirect thrown back by Flickr to get the login cookie. From there on, it retrieved those pesky photo pages with no further problems.

And now, I get to run the script all over again on the views group pools to moderate the photos it missed the first twenty or thirty times I ran it. Uhh... maybe in a week's time when it'll actually have something to chew on.

Nothing much else done today aside from work. I did get out to Quiznos in Ramsey for a honey bacon club.


From fridayfiver:

1. What did you eat yesterday?
If you mean Thursday, I had an angus steak burger at Burger King.

2. Are you more likely to yell or give the silent treatment?
Most people find me to be on the quiet side, so it will likely be the silent treatment. But when I write (as in letter of complaint), I really write!

3. Who did you last grieve?
My grandmother's passing away. But that was a while back.

4. What feels good today?
Finding out about WWW::Mechanize.

5. Friday fill in: Thank you ___ for ___.
Andy Lester, WWW::Mechanize.
Yes, two questions, one answer!
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 2 comments