Just a quick post.
Wrote an RSS Feed Generator for DeviantArt Galleries.
To use it, replace yourusername with … your username.
Source code is available here.
Brief attempt at a man page.
How it Works
When life gives you lemons, use regular expressions.
I monitored http requests to find DeviantArt’s back end ajax interface (which they use to do previous/next on galleries). From there I wrote a regular expression to parse out each entry, along with entry url, image url, date, and title. From there it’s pretty straight forward.
Keep in mind, I can’t guarantee this will work for you. If it’s been some time since I posted this, you may want to check if they’ve reintegrated rss feeds. That said, unless they change their layout, I doubt they’ll be purposefully breaking this script.
Right now, the only thing it does is get the latest entries from the given user’s gallery — no tags or anything like that. That stuff is probably doable. If you want anything specific, you can a) use the source and change it yourself, or b) leave a comment, and I’ll add it (within reason) when I have time. If you make good changes, let me know and I’ll post them here.
artist — the artist to get the feed for (ie, your username)
count — the number of items to return. The default is 24. If set higher than your total deviations, it’ll return all of them.
export — if set, instead of returning an rss feed, it’ll just output the results in an array using var_export. Useful if you’re just trying to get your deviations on your site (and your site uses php).
nolink — by default, the rss feed will show the thumbnail image as a link back to the main deviation. Add this to disable the link part.
I’ll leave this up, but if I notice real major traffic, I’ll be taking it down and putting it elsewhere (I’ll of course leave the source up). Please don’t do anything silly like hit my url every 10 seconds. For maximum reliability, host it yourself.
If you host it yourself, there’s 3 parameters at the top of the script to change:
$usecurl=1; $url = '//www.joeterranova.net/code/deviantart.php'; $firstname.lastname@example.org (Joe Terranova)';
$usecurl — set this to 1 to use curl instead of file_get_contents. If your host doesn’t have the curl extension installed and you set this to 1, you’ll get an error — conversely, if your host has remote file opening off (like mine does), and this is set to 0, you’ll get an error.
$url — set this to the url of the script.
$webmaster — set this to your email address and name.
For any questions, comments, or feature requests, leave a comment here. I release this code under the GPL v3 (see code for details).
JoeTerranova.net Print This Post