Importing a Digg RSS Feed on My Homepage

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

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

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

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Quote: 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.

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

Quote: Plus, the search engines pick up the content with my method.

Not sure if that'll help since it's duplicate content.

a Padded Cell our articles site!

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

JeevesBond;217938 wrote: Not sure if that'll help since it's duplicate content.

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.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Megan;217945 wrote: 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.

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

Assuming I get the approval from Digg, I will post the full script on how I coded it.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Thanks for the advice. I sent them an email. We shall see what happens.

pr0gr4mm3r's picture

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, Smiling

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.