Importing a Digg RSS Feed on My Homepage
I have a question that deals with a bit of ethics as well as possibly legal.
I am working on a website, and I wanted to put dynamic news content from an external source on the homepage. A quick Google search told me that I would most likely pay to have something like that.
...but then I thought of using an RSS feed from Digg to show news content on the site...similar to how I have the recent posts on my pr0gr4mm3r.com homepage. Those recent blog posts are pulled from RSS feeds in the PHP backend.
So this is the exact code that I used to pull the information directly from Digg.
<?php
$rss = new lastRSS;
$rss->items_limit = 10;
$rss->cache_dir = PATH_LASTRSS_CACHE;
$rss->cache_time = 3600;
$rs = $rss->get('http://www.digg.com/rss/containertechnology.xml');
?>
...but it doesn't work. I realized that they require a user agent. (maybe because they discourage this kind of access??). A quick ini_set() before that above code fixed that, and it does work.
<?php
ini_set('user_agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20060601 Firefox/2.0.0.3 (Ubuntu-edgy)');
?>
So the question is...Is it ok to do this? I didn't find anywhere in Digg's term of use that said this is not ok, plus all the links in the feed goes to the Digg page, and not directly to the story.
I am aware that Digg allows you to put the feed on your site, but the only thing they offer are JavaScript inserts, and I wanted to integrate it with the home page a little better that. Plus, the search engines pick up the content with my method.
JeevesBond posted this at 13:28 — 16th April 2007.
He has: 3,956 posts
Joined: Jun 2002
Hmmm, well that's difficult to say, I am not a lawyer and all that! I've e-mailed Digg about things before and had a reply. I think you can legally cover yourself quite well by sending them an e-mail asking whether it's alright to copy their RSS feed and put something along the lines of: 'if no reply is received by date x I will assume your consent to use the RSS feeds from your site'. Again, I am not a lawyer but you're giving them an opportunity to disagree with your usage of their public services.
That's an interesting code snippet though, thanks for sharing. Could you let us know what Digg says? It will be useful for anyone wanting to use that code snippet.
Not sure if that'll help since it's duplicate content.
a Padded Cell our articles site!
Megan posted this at 15:53 — 16th April 2007.
She has: 11,421 posts
Joined: Jun 1999
Exactly, and Digg has way, way, way more page strength than you do. There is no way you could outrank them with the same content. And Google is really starting to crack down on duplicate content.
It could work better with other search engines if that's what you're thinking.
Megan
Connect with us on Facebook!
pr0gr4mm3r posted this at 15:59 — 16th April 2007.
He has: 1,502 posts
Joined: Sep 2006
Ok, then scratch the SEO. I still would rather have the data in XML format so I can display it how I want rather than going through their styler.
I use TBS for my websites, and that and lastRSS makes it easy.
Assuming I get the approval from Digg, I will post the full script on how I coded it.
pr0gr4mm3r posted this at 15:32 — 16th April 2007.
He has: 1,502 posts
Joined: Sep 2006
Thanks for the advice. I sent them an email. We shall see what happens.
pr0gr4mm3r posted this at 04:44 — 21st April 2007.
He has: 1,502 posts
Joined: Sep 2006
Well, I haven't heard back, so I'm going to assume it's not a problem. If anybody uses this snippet and gets yelled at, please let me know,
You will have to modify a few things in the script. First, you are required to include the TBS & lastRSS classes. I don't have include statements because I make use of the __autoload() function. Second, you will notice that I left some of my predefined constants in the script (PATH_LASTRSS_CACHE & PATH_TEMPLATES_WEB). You will have to either define them or replace as necessary.
PHP Script:
<?php
/* Digg needs to have a user agent set */
ini_set('user_agent', 'PHP');
/* create the object */
$rss = new lastRSS();
/* set the max number of ites we want */
$rss->items_limit = 10;
/* set the cache directory so we don't hit the site for the feed every time we have a page load */
$rss->cache_dir = PATH_LASTRSS_CACHE;
$rss->cache_time = 3600;
/* get the feed */
$rs = $rss->get('http://www.digg.com/rss/containertechnology.xml');
/* create the template object */
$tbs = new clsTinyButStrong();
/* set the main tamplate file */
$tbs->LoadTemplate(PATH_TEMPLATES_WEB . 'feed_example.htm', false);
/* merge the block for the feed items */
$tbs->MergeBlock('blkNews', $rs['items']);
/* parse the template */
$tbs->Show();
?>
HTML Template:
<!-- Short and simple example of using a block :). -->
<h4>Digg.com News</h4>
<ul>
<li><a href="[blkNews.link;magnet=div;block=li;noerr]">[blkNews.title]</a><br>[blkNews.pubDate]</li>
</ul>
I hope this is helpful!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.