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 Print This Post
sunysky | 07-Mar-08 at 9:38 am | Permalink
does it exist for favorites?
Van | 23-Mar-08 at 8:42 am | Permalink
This is brilliant, thanks Joe. I’ve been trying for 10 minutes now to think of a way to politely pose an email to the DeviantArt admin that their failure to establish a decent RSS system here is pathetic, but I seem to lack the language skills to drive home the urgency of the matter without reverting to calling them a pack of useless fucking pricks. Sigh.
Kol Tregaskes | 26-Mar-08 at 10:28 am | Permalink
Great stuff. Is there a generator for your contacts and even better your favourites?
Josef | 30-Mar-08 at 1:21 pm | Permalink
Fucking brilliant, Joe!!! Thank you very much, this saves a lot of time (I’ll use DA’s feed to feed all my other photo feeds, so the work will be done just one time).
Thank you Joe
Poly | 02-Apr-08 at 6:24 am | Permalink
Man this it’s preety good, but i can suggest you something … Cdata can’t be parsed … so … you can write kind of media:thumbnail istead of Cdata … so i can parse it … or … if you could tell me how can i get parse the link of the photo would be great (in regex ). I need it in Rainmeter if you heard about it , so i can make a skin with photos from deviantart, from a profile (user). Thanks man.
joe | 04-Apr-08 at 8:18 pm | Permalink
@Poly,
Please see the code above. Feel free to edit the script accordingly, as I don’t really understand what you’re talking about …
Isa | 01-May-08 at 12:43 am | Permalink
Right after the idea struck me, I hit google with “deviantart php” and got this as the first result… Thanks ^^
I’m hoping this already does, or can be modified to create a ‘mediastream’ feed that Flock will like.
Basilakis | 19-May-08 at 3:52 pm | Permalink
joe, it seems that deviant has blocked the script or something. It is not working in any case correctly, as it seems that it loads for a lot of time, and then no result. Is it something code like?
Johann | 26-Jun-08 at 6:27 am | Permalink
Dude, you are a genius! Thank you SO Much for this! I’ve been looking for something like this for… well, years!
So, thank you!
Question though: do you have something like this for Journals as well?
Cheers,
Johann.
Jerry | 20-Jul-08 at 3:06 am | Permalink
Thank you! The pasties don’t seem to work right…
Johann | 22-Jul-08 at 4:18 am | Permalink
Joe, heh, it’s me again!
I’ve been using this script of yours for a while now and it works like a charm – thanks!
However, I have uploaded some art recently that I had to put a mature warning on, and these items are now showing up in my gallery. I contacted dA but they are, as always, not very responsive (read: they are just ignoring me…)
Do you have any idea what I can change the $surl value to go get the mature deviations as well?
Thanks for your help man, appreciate it.
Cheers,
Johann.
GillianIvy | 29-Jul-08 at 5:21 am | Permalink
Any fix for the $usecurl error? My host returns error if set to 1 and null if set to 0.
Jixor | 03-Sep-08 at 12:57 pm | Permalink
Hey, I have recently been learning xsl so your script got me inspired. I have made a deviant art rss feed generator that uses dom/xsl rather than regular expressions. You might be interested to check it out. Also learning from your site I didn’t make an online version, download only, so thanks for the warning! link: http://blog.jixor.com/deviantartfeed
Catch.
Kevin | 01-Oct-08 at 10:31 pm | Permalink
Awesome! Wish they would just support RSS themselves. Any idea how to also get scraps in addition to main gallery?
Josh | 07-Dec-08 at 6:47 pm | Permalink
Is this still working for you?
joe | 07-Dec-08 at 8:01 pm | Permalink
Josh, I haven’t tried it. I removed the version active on my site, because so many people used it Deviant Art blocked my IP.
Josh | 07-Dec-08 at 10:38 pm | Permalink
Thanks for the response. I tried it on my server and I don’t get anything back… just wanted to see if it was working for you still. Have a good one.
Ronnie | 09-Jan-09 at 8:58 am | Permalink
Tnx joe..it was awesome…tnx for the code..[link]
woebbi | 12-Jan-09 at 1:10 pm | Permalink
Hey, nice script
and on my Site it is working!
http://fretsonfire.de/web.php?artist=woebbi
You can use it if you want.
Catzie | 28-Apr-10 at 11:25 pm | Permalink
Thanks so much for this sir. Being able to host this script on my own server adds flexibility. It’s a lot of help.