- Joe Terranova - //www.joeterranova.net/blog -

RSS Feed Generator for DeviantArt

Posted By joe On February 11, 2008 @ 4:10 pm In code,New Jersey LoCo Team | Comments Disabled

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 [1].

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 [2]. 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 [3]

Article printed from Joe Terranova: //www.joeterranova.net/blog

URL to article: //www.joeterranova.net/blog/2008/02/11/rss-feed-generator-for-deviantart/

URLs in this post:

[1] here: //www.joeterranova.net/code/deviantart.php.txt

[2] var_export: http://www.php.net/manual/en/function.var-export.php

[3] JoeTerranova.net: //www.joeterranova.net

Copyright © 2008 Joe Terranova. All rights reserved.