RSS Feed Generator for DeviantArt

Just a quick post.

Wrote an RSS Feed Generator for DeviantArt Galleries.

To use it, replace yourusername with … your username.

//www.joeterranova.net/code/deviantart.php?artist=yourusername

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.

Options:

artist — the artist to get the feed for (ie, your username)

ex: deviantart.php?artist=yourusername

count — the number of items to return. The default is 24. If set higher than your total deviations, it’ll return all of them.

ex: deviantart.php?artist=yourusername&count=10

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).

ex: deviantart.php?artist=yourusername&export=1

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.

ex: deviantart.php?artist=yourusername&nolink=1

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';
$webmaster='joeterranova@gmail.com (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