[Pligg 8.2.0] Submit a feed automatically : The recap

Register an Account
Pligg Chat Room
Closed Thread
 
LinkBack Thread Tools Display Modes
  #31 (permalink)  
Old 06-06-2006, 10:40 PM
New Pligger
 
Join Date: Jun 2006
Posts: 9
Does this code check for duplicate links? I can have the cron job run once a day, but if the RSS is not updated, would it add the links again or just ignore the old links and add new links, if any?

Thanks

Quote:
Originally Posted by dwg
Using Magpierss, here is something quick and dirty that seems to work for me. Not sure how to get the tags inserted, but the rest should work. Just set it up as a cron.

Code:
<?
require('../magpierss/rss_fetch.inc');

include('config.php');
require(mnminclude.'link.php');

$rss_feeds=array (
        array(
                'url'=>"http://digg.com/rss/index.xml",
                'category'=>7,
                'author'=>16,
//              'tags'=>'
        ),
);


echo "<ul>\n";
foreach ($rss_feeds as $feed ) {
$rss = fetch_rss($feed['url']);
echo "<li>Site: ", $rss->channel['title'], "<br>\n";
foreach ($rss->items as $item ) {
        $item['author']=$feed['author'];
        $item['category']=$feed['category'];
 
        $title = $item[title];
        $desc= $item[description];

        echo "<ul>";
        echo "<li>Processing <a href=$url>$title</a></li>\n";
        rss_store($item);
        echo "<li>Finished Processing <a href=$url>$title</a></li><br><br/>\n\n";
        echo "</ul>";

}

echo "</li>";
}
echo "</ul>";


function rss_store($item) {

        $linkres=new Link;

        $edit = false;
        $linkres->get(trim($item['link']));

        if(!$linkres->valid) {
                rss_error($item['link']);
                return;
        }

        if($linkres->duplicates($item['link']) > 0) {
                rss_error($item['url']);
                return;
        }
        $linkres->status='discard';
        $linkres->author=$item['author'];

        $linkres->title=$item['title'];
        $linkres->content=$item['description'];


        $linkres->id=0;
        $linkres->category=$item['category'];
        $linkres->randkey=rand(10000,10000000);
        $linkres->read();
        $linkres->status='queued';
        $linkres->store();
        return;
}

function rss_error($url){
        echo "Skipped $url <br/>\n";
}


?>
  #32 (permalink)  
Old 06-07-2006, 12:37 AM
New Pligger
 
Join Date: Jun 2006
Posts: 9
never mind. Find out that it does check for duplicates, which is great!!
  #33 (permalink)  
Old 06-08-2006, 04:58 PM
New Pligger
 
Join Date: May 2006
Posts: 21
any chance you could make it so anything submited by feeds is automatically published?
  #34 (permalink)  
Old 06-12-2006, 01:09 AM
New Pligger
 
Join Date: May 2006
Posts: 11
im getting an error message. any one know how to help me?

Warning: require(/magpierss/rss_fetch.inc) [function.require]: failed to open stream: No such file or directory in /home/.dickon/crackers1/www.bombconstruction.com/rssfeed.php on line 5

Fatal error: require() [function.require]: Failed opening required '/magpierss/rss_fetch.inc' (include_path='.:/usr/local/php5/lib/php') in /home/.dickon/crackers1/www.bombconstruction.com/rssfeed.php on line 5

*EDIT**************

it magically works now.. mmhmm... okay...

http://bombconstruction.com/shakeit.php

have a look at some of the article titles... eg...
Lilly: Drug cuts diabetics' %&#vision loss - CNN

how do i fix that?

Last edited by crackah; 06-12-2006 at 02:39 AM.
  #35 (permalink)  
Old 06-12-2006, 11:21 AM
Casual Pligger
 
Join Date: May 2006
Posts: 63
OK, so I need to install Magpie for this?
  #36 (permalink)  
Old 06-12-2006, 12:59 PM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,181
crackah

the url seems to be encoded.
when it is out it should be decoded.

try this:

/libs/link.php

$smarty->assign('url_short', $url_short);

replace this with

$smarty->assign('url_short', urldecode($url_short));

but i dunno how safe that is.
will find out.
  #37 (permalink)  
Old 06-12-2006, 07:08 PM
New Pligger
 
Join Date: Apr 2006
Posts: 12
I got this error when setting a cron jobs..

/bin/sh: line 1: www.domain.com/magpierss/mycronjob.php: No such file or directory

question :
How do i set a cron job ?
do i need to point to that phpfile ?
  #38 (permalink)  
Old 06-14-2006, 06:22 PM
New Pligger
 
Join Date: Apr 2006
Posts: 12
Finally It worked, my path is incorrect thats why i encountered my problem

thanks...

how can I limit the amount of item to be posted for example
I only want to get 3 items per site.
  #39 (permalink)  
Old 06-20-2006, 07:44 AM
Casual Pligger
 
Join Date: Jan 2006
Posts: 65
hmm I wonder if you could have it post but tag it as a discarded story so it does not show up.. then.. with some kind of admin panel.. go in and have a looksy what it is giving you under that user name.. tick the ones you want to show up.. and un discard them.. edit the titles etc before introducing them... a little more work but gives the more human look to them.. no??
  #40 (permalink)  
Old 06-24-2006, 11:58 AM
juicecowboy's Avatar
Casual Pligger
 
Join Date: Jun 2006
Location: San Jose, CA
Posts: 53
Send a message via Yahoo to juicecowboy
Need help with this--

It works excellent. one thing - on initial import, there are like 10 stories. I usually discard many of them (so that user-submitted stories don't get buried in the queue). On the next import, it picks up the "discard" stories again and puts them in the queue. It makes for alot of work with mysqladmin but if the script could include "discarded" stories in the duplicate checking that would be great.

I'm not much of a coder but I'm hoping this isn't hard. Could someone give me a quick tutorial on how to make this script check queued and discard stories?
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to automatically check for updates in rss feed? marcinpl87 Questions and Comments 3 01-14-2010 12:06 AM
Some ideas to build a Pligg site Divisive Cotton Questions and Comments 22 10-22-2009 10:46 AM
Auto submit story on submit step 3 for god only gnalkit Questions and Comments 2 10-13-2009 08:47 AM
RSS Import Feed - Feed Frequency Not working ant560 Questions and Comments 4 03-15-2008 04:31 AM
Import RSS Auto submit feed argh2xxx Questions and Comments 12 09-12-2007 04:02 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development