(Update 2021: Oh Ruben, you used to be so cringe. Wait, used to?)
While I revel in this more traditional approach to blogging (when it works, looking at you WordPress), I do admit I'm jealous of how it easy it is for people on Tumblr to re-post entries from other tumblogs (that is the term, right?). Say… this one, for example!
So here’s my idea
Usually I would start reading up on a site's API, but with so many things to do right now I decided to take the easy way out given I'd only be using it in a personal context. Here's my idea:
- Write a crappy Python script that accepts the URL/URI/address for a Tumblr entry I’d like to re-post in true Tumblr-like fashion.
- Use curl to grab the page, or fetch, or… heaven forbid, wget.
- Extract the textual information from the post, including the links to the people who re-posted it.
- Download local copies of the image(s) in a post and use ImageMagick to scale and convert them.
- SFTP to my webserver and upload the image(s)
- Connect to my WordPress database, add all the stuff, done.
Of course things aren’t that simple!
How so? Ugh I hate rhetorical questions, mainly because I always need to consult a spell checker whenever I spell rhetorical.
For example, the picture of the girl above whom I can't stop looking at for some reason was saved on Tumblr as a gigantic PNG. What?! I know it could be saved as a JPEG and save a ton of space and bandwidth, but ImageMagick can't tell that from a diagram that should be kept as a PNG. In other words, it couldn't be an entirely automated process. Perhaps I could specify along with the URL I'm giving the script whether or not the images should be messed with. Ugh, but then it's not as automatic, which kinda defeats the purpose.
Secondly, Tumblr allows people to share far more than just pictures. If someone embedded a YouTube video or something else, what do I do then? I prefer hosting my own copies of stuff with attributions becuase I don't like relying on third party sites to stay alive. Why am I hearing Bee Gees all of a sudden? Ha, ha, ha, ha, staying alive… staying alive. Ha, ha, ha, ha, staying aliiiiiiive!
Thirdly, I shouldn't do this hack job and instead use the public APIs to get all the information I need and implement it in a WordPress plugin. It'd mean I'd have to actually learn PHP for real instead of just the hackish bits and pieces I've picked up from my Perl days and from maintaining MediaWiki and WordPress installs.
Okay I admit it!
This entire post was an excuse to post that picture. I'm a sucker for eyes, and I'm lonely, shaddup.