The first part is grabbing the strip - slightly non-trivial as they stick a random number in the image name for exactly that purpose, but I did this years ago to grab the latest Dilbert and User Friendly for the company intranet each day.
Creating the icon was surprisingly straightforward using ImageMagick - a bit of manual inspection to figure out where the box boundaries are, then coding up a few simple crop and resize operations, and the save out as an animation works automagickally.
By far the hardest part was doing the upload, involving a whole bunch of HTTP requests:
- Hit the login page with the username and password to get session cookies.
- Grab the current edit pics page, saving all the existing icon names and which one is default (this info has to be sent back with the two updates), also to find the ID of the existing Dilbert icon.
- Post to the edit pics page to delete the existing icon.
- Upload the new icon, and parse the page to find out the new ID.
- Post to the edit pics page one final time to put the keyword on the newly uploaded icon.
Update: W00t! It works! Todays strip is there completely sans human intervention.
September 26 2003, 04:01:11 UTC 17 years ago
September 26 2003, 04:11:03 UTC 17 years ago
Besides, I suspect that a good proportion of the userpics on LJ have some kind of copyright issues...