News:

Wondering if this will always be free?  See why free is better.

Main Menu

RSS Feed Poster

Started by SMFHacks.com Team, January 11, 2007, 07:46:04 PM

Previous topic - Next topic

MrWizard

How to get it to remove or otherwise convert the embedded HTML inside the RSS feed to either bb code (where applicable) or remove all together ?

The "enable html" doesn't appear to do much except catch the title.  enabling/disabling "simple html" inside the forum also makes little difference.


  Feed URL : http:hxxp:news.google.com/news?hl=en&tok=cEAjN617gdb8iQC1aT4ffg&ds=n&pq=%22murphy+texas%22&cp=8&gs_id=ie&xhr=t&q=%22murphy,+texas%22&safe=off&gl=us&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&biw=1482&bih=949&um=1&ie=UTF-8&output=rss [nonactive] 

   Posting looks like : <table border="0" cellpadding="2" cellspacing="7" style="vertical-align:top;"><tr><td width="80" align="center" valign="top"><font style="font-size:85%;font-family:arial,sans-serif"></font></td><td valign="top" class="j"><font style="font-size:85%;font-family:arial,sans-serif"><br /><div style="padding-top:0.8em;"><img alt="" height="1" width="1" /></div><div class="lh"><a href="http:hxxp:news.google.com/news/url?sa=t&amp;fd=R&amp;usg=AFQjCNEhNUYxwH_VsfjxDPdwMICQFBoXOw&amp;url=http [nonactive]:hxxp:www.cantonrep.com/life/weddings/x1062477557/Peirce-Fromholtz-wedding [nonactive]"><b>Peirce-Fromholtz wedding</b></a><br /><font size="-1"><b><font color="#6f6f6f">Canton Repository</font></b></font><br /><font size="-1">They reside in <b>Murphy, Texas</b>. Rachel Peirce of Katy, Texas and Kyle Fromholtz of North Canton, Ohio were married April 21, 2012 at The Milestone in Denton, Texas by the Rev. Randy Prouse. Parents of the bride are James and Nancy Peirce of Katy, Texas.</font><br /><font size="-1" class="p"></font><br /><font class="p" size="-1"><a class="p" href="http:hxxp:news.google.com/news/more?gl=us&amp;pz=1&amp;ned=us&amp;ncl=dZx6dHmB56URzvM [nonactive]"><nobr><b></b></nobr></a></font></div></font></td></tr></table>


chuck23322

#2581
MrWiz -- I don't think the RSS Feed Poster is that "intelligent" to make conversions from HTML -> BB code, etc.   It's there to simply take the feed and post it.  If it has HTML embedded in the "description" field, it posts it too.   

You would likely need to see if the "feed" can be adjusted so that it outputs plain text instead {if that vendor offers it}....

Or you may be able to use "Yahoo Pipes" to do some conversions on the feed using RegEx -- I use Yahoo Pipes to do some work on my feeds -- but the scope of assisting with Yahoo Pipes is beyond what I can offer here.

Something like (on Yahoo Pipes) - Fetch Feed -> loop w/ regex against desc field to remove html -> Create Rss -> output pipe

http://networking.ringofsaturn.com/Web/removetags.php
http://www.pagecolumn.com/tool/all_about_html_tags.htm

Or you can search the Yahoo Pipes to see if somebody else has already created a pipe to remove HTML that you can modify/customize...

Perhaps somebody has a better answer.   I tend to use Yahoo Pipes to be a brute-force tool since I'm needing to create RSS feeds from web pages, etc that don't provide RSS...

~Note:  The Yahoo Pipes generates a RSS link that has special characters in it, and the feed poster doesn't like the link.  For each of my Yahoo Pipes RSS feeds I use, I've created a "tinyurl.com" version of the Yahoo Pipes RSS link and that works fine.

MrWizard

After looking at the code, I am thinking a simple patch for this should work ..  In the file Subs_RSS.php

Adding html_entity_decode() and strip_tags() to fix up the variable $rssdata at the end should clean it up ..

   

   // Remove stupid headers.


   do


{


$header .= fgets ($fp, 128 );

} while ( strpos($header, "\r\n\r\n" ) === false );

   while (!feof($fp))

   

   {

       $rssdata .= fgets($fp, 128);

   }

   fclose($fp);




   // Get rid of the stupid header information! Wish the function did it for me.

   
   @$finalrss = $rssdata;


}

}

avguste

Just installed this, but cant figure how to get it to work.
Could someone post how to setup a cron job?

Also, when I go to the cronrss url ( http://political.antonovconsulting.com/cronrss.php ), I get an internal error

Thank you

chuck23322

Quote from: avguste on August 10, 2012, 08:00:20 PM
Just installed this, but cant figure how to get it to work.
Could someone post how to setup a cron job?

Also, when I go to the cronrss url ( http://political.antonovconsulting.com/cronrss.php ), I get an internal error

Thank you

Until you get the manual "cronrss.php" running -- the setting up a cron job won't work.

There's dozens of posts in this thread about the varying options available for a cron job.

But your first step needs to be getting the "cronrss.php" to return the "Feed Poster Configuration" answer (and see your first feed item posted)

Much later -- then you worry about whether to use cron, fake cron, or scheduled tasks.

avguste

how do I get the manual cronrss.php running ?

chuck23322

Quote from: avguste on August 10, 2012, 10:11:11 PM
how do I get the manual cronrss.php running ?

I don't know.  But that's square #1 to start with.   Suggest you re-try the instructions.

The error message 404 -- says you have things installed in the wrong place.

Go back and re-read their directions.

The Mod, I didn't write.   I can't help you or others until you at least have it working with the original instructions.

avguste

The mod was installed using the package installer and everything seems to be well installed. Will see what happens when my host activates the fsockopen,fopen, or curl php function

avguste

Hmm. I just saw that the feed did pull articles as of this morning. The cronrss.php is still not working, but seems the feed is working

antler

This may have been asked before but I can't find it ......Trying to configure the RSS Fee Poster 3.0.4

First question:Exactly What does Topic Prefix mean? can you give me an example?

And does it affect this error message?

XML error: Not well-formed (invalid token) at line 1

chuck23322

Quote from: antler on August 13, 2012, 02:45:16 PM
This may have been asked before but I can't find it ......Trying to configure the RSS Fee Poster 3.0.4

First question:Exactly What does Topic Prefix mean? can you give me an example?

And does it affect this error message?

XML error: Not well-formed (invalid token) at line 1

Are you getting that error when trying to save the feed ?  -- If so, and it has special characters in it -- create a "tinyurl.com" equivalent version -- my Yahoo Pipe URLs aren't liked...    so I give the RSS Feed the "tinyurl" version and it's happy again.

Topic Prefix is -- say a title comes across as:

"Pitcher McGruff tossed out by umpires"

And maybe you have another feed too... and it's got an article of

"Banana prices to soar soon"

They obviously may be coming from different sources.   So you could do a "Topic Prefix" for each...

"{Sports News} - Pitcher McGruff tossed out by umpires"

"{Banana News} - Banana prices to soar soon"

You would use "{Sports News} -" as your topic prefix for the first feed, and {Banana News} - " as the topic prefix for the other.

...Chuck

antler

Thanks, do you utilize the brackets or are you using them foer emphasis?

chuck23322

Quote from: antler on August 13, 2012, 03:16:41 PM
Thanks, do you utilize the brackets or are you using them foer emphasis?

Yea, I use them for emphasis -- not required.

And you have to be specific with spaces...

If you do a topic prefix of "RSSFeed" for example...

Then you get titles like:  "RSSFeedBanana prices to soar soon"

So you have to put in the trailing space, etc yourself -- and of course, it's not obvious whether it's "RSSFeed" or "RSSFeed "

MrWizard

Heres a patch that (so far) removes the spurious HTML from postings.  I hope its useful for someone else..



*** Subs-RSS copy.php   Sat Aug 11 11:32:09 2012
--- Subs-RSS.php        Sat Aug 11 21:05:12 2012
***************
*** 321,327 ****
                                                                        if (!empty($feed['footer']))
                                                                                $msg_body .=  $func['htmlspecialchars']("\n\n" . $feed['footer'], ENT_QUOTES);
                                                                }
!                                                               
                                                               
                                                                $msg_title = mysql_escape_string($msg_title);
                                                                $msg_body = mysql_escape_string($msg_body);
--- 321,328 ----
                                                                        if (!empty($feed['footer']))
                                                                                $msg_body .=  $func['htmlspecialchars']("\n\n" . $feed['footer'], ENT_QUOTES);
                                                                }
!                                                               $msg_body = html_entity_decode($msg_body);
!                                                               $msg_body = strip_tags($msg_body);
                                                               
                                                                $msg_title = mysql_escape_string($msg_title);
                                                                $msg_body = mysql_escape_string($msg_body);
***************

Texan78

Has anyone encountered any issues running this mod and have httpBL installed also?

I can call the cron file no problem in my browser. When I set up the cron though I get this error.

Quote<br />
<b>Warning</b>:  Missing argument 1 for httpBL_look_for_empty_ip(), called in /home4/mesquiu0/public_html/wxconnection/Sources/httpBL_Subs.php on line 680 and defined in <b>/home4/mesquiu0/public_html/wxconnection/Sources/httpBL_Subs.php</b> on line <b>517</b><br />
<br />
<b>Notice</b>:  Undefined variable: ip in <b>/home4/mesquiu0/public_html/wxconnection/Sources/httpBL_Subs.php</b> on line <b>519</b><br />

Which is regarding the httpBL mod, but what exactly is conflicting with it?

-Thanks

riou

Quote from: Texan78 on August 15, 2012, 01:46:16 AM
Has anyone encountered any issues running this mod and have httpBL installed also?

I can call the cron file no problem in my browser. When I set up the cron though I get this error.

Quote<br />
<b>Warning</b>:  Missing argument 1 for httpBL_look_for_empty_ip(), called in /home4/mesquiu0/public_html/wxconnection/Sources/httpBL_Subs.php on line 680 and defined in <b>/home4/mesquiu0/public_html/wxconnection/Sources/httpBL_Subs.php</b> on line <b>517</b><br />
<br />
<b>Notice</b>:  Undefined variable: ip in <b>/home4/mesquiu0/public_html/wxconnection/Sources/httpBL_Subs.php</b> on line <b>519</b><br />

Which is regarding the httpBL mod, but what exactly is conflicting with it?

-Thanks


That is an issue with the httpBL mod, with cronjobs running on forum

Texan78

Quote from: riou on August 15, 2012, 12:02:39 PM
That is an issue with the httpBL mod, with cronjobs running on forum

Yes, I have established that already, but what exactly with that mod is causing the conflict with this mod?

Texan78

#2597
Quote from: MrWizard on August 14, 2012, 01:09:57 PM
Heres a patch that (so far) removes the spurious HTML from postings.  I hope its useful for someone else..



*** Subs-RSS copy.php   Sat Aug 11 11:32:09 2012
--- Subs-RSS.php        Sat Aug 11 21:05:12 2012
***************
*** 321,327 ****
                                                                        if (!empty($feed['footer']))
                                                                                $msg_body .=  $func['htmlspecialchars']("\n\n" . $feed['footer'], ENT_QUOTES);
                                                                }
!                                                               
                                                               
                                                                $msg_title = mysql_escape_string($msg_title);
                                                                $msg_body = mysql_escape_string($msg_body);
--- 321,328 ----
                                                                        if (!empty($feed['footer']))
                                                                                $msg_body .=  $func['htmlspecialchars']("\n\n" . $feed['footer'], ENT_QUOTES);
                                                                }
!                                                               $msg_body = html_entity_decode($msg_body);
!                                                               $msg_body = strip_tags($msg_body);
                                                               
                                                                $msg_title = mysql_escape_string($msg_title);
                                                                $msg_body = mysql_escape_string($msg_body);
***************

Can you provide a little more information about this as in Find, replace with, after add directions should they apply and what file this goes into. it says Subs-RSS.php from your post but I don't have that file, only Subs-RSS2.php. I am using the most currently release of this mod. Installed it yesterday and I am having the same HTML issues in some feeds as you're describing. So wanted to try this patch.

Also more info on the cron. When I ran it in the browser before it worked fine. Now when I run it I get the error below and nothing has changed except for setting up the cron to run. Sometimes it works right, sometimes it doesn't.

An Error Has Occurred!
The database value you're trying to insert does not exist: current_board


UPDATE: Here is some more info on the error above. Going into my log files I have this critical error.

http://www.wxconnection.com/cronrss.php
The database value you're trying to insert does not exist: current_board
Function: tiwtt_get_boards2
File: /home4/mesquiu0/public_html/wxconnection/Sources/Twitter/TwitterHooks.php
Line: 627


Why the cron is even conflicting with my twitter mod has me stumped.

This is line 615-627 which the last line 627 is the line they are referring to

function tiwtt_get_boards2($board=0){
global $smcFunc, $context, $board;

   $req1 = $smcFunc['db_query']('', '
SELECT COUNT(*) AS total
FROM {db_prefix}boards
WHERE tweet_pubenable = {int:one} AND id_board = {string:current_board}',
   array(
            'one' => 1,
            'current_board' => $board,
        )
);


   Any suggestions has to why this is occurring and conflicting with two separate mods? It was working first at first and nothing has changed.

-Thanks

sajjad

#2598
hi
thanks for this mod
but this mod has problem in persian lang
when send a topic
Instead be written (سلام)
write (? ? ? ?)

how do i fix ?
SMF Group Forever

Texan78

Any information for my post above?

The RSS feed updates but not without errors from the cron, so I am not sure if the cron is updating it or if the mod is updating it.

I would really like to get this resolved before I launch the forum Sept 1st.

-Thanks

Advertisement: