vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   NEW Modified RSS News Feed Hack (https://vborg.vbsupport.ru/showthread.php?t=63798)

Slapyo 04-12-2004 10:00 PM

NEW Modified RSS News Feed Hack
 
Hack originally posted by: Xyphen - RSS News Feed Hack
Modified by: wolfstream - Modified RSS News Feed Hack

I am posting this up as a new hack because of the major changes made to how the script works. Also, I didn't want people to get confused as to which one to download since there were 3 different versions on the original post.

Xyphen released the original version, then wolfstream modified the script and corrected some errors. After that, I modified wolfstreams version to change how posts were inserted. Now the post count will increase, posts will be able to be searched, and similiar threads will work.

RSS News Feed Hack for vB 3.0.x. As long as vBulletin doesn't change the database structure much, this should be good for the next release also, and those to come.

Allows you to have a live RSS news feed (such as one from Google or CNET) in a forum. The user that posts it will basically be a bot, which *should* only be used for posting the news, but you can even make it for a regular user.

Comments are welcome! Support provided through this thread.

Latest Version:
- 1.26 - for PHP 4.3.0 & above
- 1.26a - for PHP prior to 4.3.0

vBulletin Versions:
- 3.0.0
- 3.0.1

PHP Versions:
- > 4.3.0
- < 4.3.0

Installation Overview:
- Files to edit: (2) /admincp/index.php, /includes/functions_newpost.php
- Files to upload: (4) rss.php, admincp/rss_admin.php, includes/RSS/class.RSS.php, includes/RSS/rss_update.php
- Queries to run: (4) in rss_install.php

History:
Version 1.26 (23 June 2004 - Slapyo, Natch)
- listing of bot's more intuitive (Natch)
- hopefully fixed duplicate problem (Slapyo)
- stripped html tags from title and description (Slapyo)

Version 1.25 (12 May 2004 - Slapyo)
- fix for &quot; showing up
- logs action in scheduled task log if turned on

Version 1.24 (20 April 2004 - Slapyo)
- posts now deleted with delete_thread function
- post counts updated when using delete all news

Version 1.23 (14 April 2004 - Slapyo)
- added ability to delete bots
- cleaned up includes
- fix for PHP versions prior to 4.3.0 calling html_entity_decode()

Version 1.22 (13 April 2004 - Slapyo)
- duplicate posts problem fixed
- fix for problem with ' appearing as \'

Version 1.21 (12 April 2004 - Slapyo)
- bot will not be subscribed to posts now

Version 1.2 (11 April 2004 - Slapyo)
- posts now inserted with build_new_post function

Version 1.1 (28 March 2004 - wolfstream)
- file edits taken down to 1
- cron script included

Version 1.0 (28 January 2004 - Xyphen)
- original release

Common RSS Feeds:
- Yahoo!
- CNET.com
- BBC
- Wired News
- The Register
- Ars Technica
- All Headline News

mharmon 04-13-2004 02:10 AM

I tried it this evening and had it working in 5 minutes.. AWESOME! :)

dethfire 04-13-2004 03:57 AM

yep, this works! only problem is that it doesn't check if news item already exist, so for all my cron I had to set it to 24h to make sure the rss files were completely changes with new items, otherwise it's a charm!

achtungbaby 04-13-2004 03:59 AM

I have a problem. First, I got this error after uploading the new files:

Code:

Database error in vBulletin 3.0.0:

Invalid SQL: CREATE TABLE `rss_settings` (`enabled` tinyint(1) NOT NULL default '1' ); mysql error: Table 'rss_settings' already exists

mysql error number: 1050

Date: Monday 12th of April 2004 09:46:35 PM
Script: http://forums.yellowworld.org/rss_install.php
Referer:
Username: achtungbaby

I assumed maybe it was cause I'd accidentally left the old RSS files. So then I run the upgrade and get this error:

Code:

Database error in vBulletin 3.0.0:

Invalid SQL: ALTER TABLE rss_settings DROP forumid, DROP userid, DROP source mysql error: Can't DROP 'forumid'. Check that column/key exists

mysql error number: 1091

Date: Monday 12th of April 2004 09:46:51 PM
Script: http://forums.yellowworld.org/rss_upgrade.php
Referer:
Username: achtungbaby

And now it appears that much of my forums has disappeared. What happened?

achtungbaby 04-13-2004 04:17 AM

Nevermind. I think I figured it out. The script was conflicting with another hack I installed earlier -- the welcome PM hack.

Slave 04-13-2004 04:27 AM

Whoo .. cool hack/add on :) ..

I've been having a play on my dev board .. a few things jump out at me ..

(I'm using a BBC rss news feed btw)

1/ I'm getting \ in front of ' .. any way to stop that?

2/ Any reason for the bot to subscribe to the thread? as it seems to do it .. if not needed how would you stop that?

3/ I've run the rss cron job 3 times in the last few mins to test it .. and it doesn't seem to know that it's already posted a story and therefore reposts it. Is the subscription to the thread meant to stop that? Is there any way to get the bot to know it has already posted about a subject?

I'll continue playing and post if anything else seems amiss ..

Good job though :)

Slapyo 04-13-2004 04:55 AM

<a href="http://www.sportsbabble.net/showthread.php?t=570" target="_blank">http://www.sportsbabble.net/showthread.php?t=570</a>

there is a link to a post made by my news bot and it has ' in it ... but without the leading \, what is the link to the rss feed you are using?

i just uploaded a new version that fixes the bot subscribing to the threads. it should no longer subscribe to threads. the change was in rss_update.php so you can upload just that file if you want.

i can't see what is causing the problem with stories being posted multiple times. on mine i don't get the multiple stories, but every once in a while. the original author included a check in the program, but it is obviously not working properly. the code for this is in rss_update.php. i will look at it more.

Slave 04-13-2004 05:34 AM

The news feed I'm using at the mo is ..

Quote:

http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml
Cheers for the subscribing fix .. :)

As for the double posting .. I guess it might be to do with the feed I'm using .. I'm sure you'll see it when you have a play if it is ..

Just added a screenshot of the \' problem .. it's happening in both titles and messages ..

rocket98 04-13-2004 06:27 AM

Hi,

Very interesting hack. I have installed it but got this error when I ran it to see what it would pull down.

Fatal error: Call to undefined function: html_entity_decode() in /homepages/23/d95339147/htdocs/public_html/forum/includes/RSS/rss_update.php on line 70

Thanks

PranK 04-13-2004 06:33 AM

The last one sent my server load through the roof - is this likely to happen with this one?

Thanks!

Christian

mirdin 04-13-2004 07:02 AM

Quote:

Originally Posted by PranK
The last one sent my server load through the roof - is this likely to happen with this one?

Thanks!

Christian

Not likely. I believe the old hack would fetch the rss feed every time someone would enter the forum.

For this one you have to set a cronjob.

jluerken 04-13-2004 07:10 AM

Quote:

Originally Posted by rocket98
Hi,

Very interesting hack. I have installed it but got this error when I ran it to see what it would pull down.

Fatal error: Call to undefined function: html_entity_decode() in /homepages/23/d95339147/htdocs/public_html/forum/includes/RSS/rss_update.php on line 70


Thanks

I get the same error
Fatal error: Call to undefined function: html_entity_decode() in /home/www/web1/html/forum/includes/RSS/rss_update.php on line 70

mirdin 04-13-2004 07:20 AM

Quote:

Originally Posted by jluerken
I get the same error
Fatal error: Call to undefined function: html_entity_decode() in /home/www/web1/html/forum/includes/RSS/rss_update.php on line 70

This function is only present in PHP 4.3.0 and later, which version are you running?

http://www.php.net/manual/en/functio...ity-decode.php

jluerken 04-13-2004 08:07 AM

Quote:

Originally Posted by mirdin
This function is only present in PHP 4.3.0 and later, which version are you running?

http://www.php.net/manual/en/functio...ity-decode.php

I am running PHP Version 4.2.2

And what now?

mirdin 04-13-2004 10:49 AM

Quote:

Originally Posted by jluerken
I am running PHP Version 4.2.2

And what now?

You'll have to ask your host to upgrade to a more recent version of PHP.

Or if you follow the link to the php function I posted before, it shows this code:

PHP Code:

// For users prior to PHP 4.3.0 you may do this:
function unhtmlentities($string
{
   
$trans_tbl get_html_translation_table(HTML_ENTITIES);
   
$trans_tbl array_flip($trans_tbl);
   return 
strtr($string$trans_tbl);
}

$c unhtmlentities($a);

echo 
$c// I'll "walk" the <b>dog</b> now

?> 

If upgrading PHP is not possible for you then you could try to replace the html_entity_decode function using this example.


By the way, has anyone managed to fix the double post issues? I have these issues with both yahoo and bbc feeds.

Acido 04-13-2004 11:42 AM

Quote:

Originally Posted by Slapyo
http://www.sportsbabble.net/showthread.php?t=570

there is a link to a post made by my news bot and it has ' in it ... but without the leading \, what is the link to the rss feed you are using?

i just uploaded a new version that fixes the bot subscribing to the threads. it should no longer subscribe to threads. the change was in rss_update.php so you can upload just that file if you want.

i can't see what is causing the problem with stories being posted multiple times. on mine i don't get the multiple stories, but every once in a while. the original author included a check in the program, but it is obviously not working properly. the code for this is in rss_update.php. i will look at it more.

I'm getting multiple Stories too. The feed that i'm using is :
Quote:

http://www.lanacion.com.ar/herramientas/rss/index.asp?origen=2
If help, the fields: rdd_feed and rss_date in the thread table, are always empty :ermm:

I'll apreciate if you can help me to avoid duplications, triplications, etc... using the bot. I think that the filter most be based in the title of the feed only, but i dont know how fix it.

Thanx in advance !

Slapyo 04-13-2004 01:27 PM

ok, i think i have solved the problem with the duplicate posts. after acido mentioned that there were blank fields for the rss_feed and rss_date i realized that the vB function doesn't insert the new data.

so, to fix it i have uploaded v1.22 ... this includes the following changes:
- one more modification to functions_newpost.php (edit and upload)
- one fix to rss_update.php (just upload new one)

mharmon 04-13-2004 01:33 PM

On the Yahoo feeds located at:

http://news.yahoo.com/rss

Is there anyway to specify a variable in the URL so you can limit the amount of headlines it grabs? I don't want 40-50 news items appearing in a forum -- I'd rather limit it to 5-10 a day..

Slapyo 04-13-2004 01:40 PM

that would be up to the feed itself if they were to accept something like that. i mean i guess you could go into the code and change the loop so that it didn't loop from:

0 -> # news articles
to
0 -> 10 (or 5)

mharmon 04-13-2004 01:42 PM

Slapyo -- Where would I change that? Can you find where that it is and shoot it over to me?

rocket98 04-13-2004 02:03 PM

[QUOTE=mirdin]You'll have to ask your host to upgrade to a more recent version of PHP.

Or if you follow the link to the php function I posted before, it shows this code:

PHP Code:

// For users prior to PHP 4.3.0 you may do this:
function unhtmlentities($string
{
   
$trans_tbl get_html_translation_table(HTML_ENTITIES);
   
$trans_tbl array_flip($trans_tbl);
   return 
strtr($string$trans_tbl);
}

$c unhtmlentities($a);

echo 
$c// I'll "walk" the <b>dog</b> now

?> 

If upgrading PHP is not possible for you then you could try to replace the html_entity_decode function using this example.


-----
I read the install instructions for this hack, it specified no where that certain version number dependencies were required before implementing ... it just said whoopee let's go!!!


It may not be possible for some of us to "TELL" our ISP to UPGRADE some ISP's don't give a rat's a$$ about what we do on their systems they just want their $4.95 a month.

Replace this CODE WHERE?

Thank you.

Acido 04-13-2004 02:12 PM

Quote:

Originally Posted by Slapyo
ok, i think i have solved the problem with the duplicate posts. after acido mentioned that there were blank fields for the rss_feed and rss_date i realized that the vB function doesn't insert the new data.

so, to fix it i have uploaded v1.22 ... this includes the following changes:
- one more modification to functions_newpost.php (edit and upload)
- one fix to rss_update.php (just upload new one)

I'm getting a Database conflict when i run the cron on the task manager:

Quote:

Database error in vBulletin 3.0.0:

Invalid SQL:
INSERT INTO thread(title, lastpost, forumid, open, replycount, postusername,
postuserid, lastposter, dateline,
iconid, visible, attach, similar, rss_feed, rss_date)
VALUES
('Rod++++ bati? su propio r?cord de velocidad en el saque', 1081868007, 1060,
1, 0, 'Deportes', 4573,
'Deportes', 1081868007, 0, 1,
0, ', 1, ')

mysql error: Column count doesn't match value count at row 1

mysql error number: 1136
New threads are created, but i need rebuild forum information to see the last post in the forum display. Also, the field rss_date is still null .

Hope help.

SnowBot 04-13-2004 02:37 PM

Quote:

Originally Posted by Slapyo

so, to fix it i have uploaded v1.22 ... this includes the following changes:
- one more modification to functions_newpost.php (edit and upload)
- one fix to rss_update.php (just upload new one)

The Zip still says 1.21. Are the new files within this zip?

Host Visions 04-13-2004 03:48 PM

Thanks for this. Any idea how to not have duplicate posts?

mirdin 04-13-2004 04:13 PM

Quote:

Originally Posted by Slapyo
so, to fix it i have uploaded v1.22 ... this includes the following changes:
- one more modification to functions_newpost.php (edit and upload)
- one fix to rss_update.php (just upload new one)

Downloaded 1.22, took the original functions_newpost.php and made the changes and uploaded it, also uploaded the new rss_update.php and still it is not recognizing already posted articles.

rss_feed fields values are all 0, rss_date fields are still empty.

SnowBot 04-13-2004 05:03 PM

i have installed this but hhhmm nothing is being posted :( any ideas?

The forum is set corectly as i have just click the delete all news posts and wiped the forum completely :( But i guess that part works......

So the bot / user isnt posting

SnowBot 04-13-2004 07:16 PM

OK i re traced my steps and now when i try and run the scedual task i get this

rss.php

ChannelData($leftOvers,$x); } return; } /* * void parse ( string data ) */ function parse($data="") { $channels = $this->parseChannels($data); if(empty($channels)) { return; } $this->parseItems($channels); return; } /* * Finito */ } ?>d); } } } } // // ------------------------------ // End of RSS News Hack ?>

Help :)

Slapyo 04-13-2004 07:51 PM

sorry guys, i tried to get the new one up before i left for class for the day and found an error so i pulled it quickly and put back 1.21. i will fix the problem and get it back up when i get home from classes for the day.

also, i will make note of the problem with php version and include a fix for those that maybe have a lower version and can't change it.

i wasn't aware of that problem, and since it was working on mine i figured it was good to go. will include that in the next fix.

i'm still at school right now between classes, won't be home till later tonight though. hopefully i will have it checking for duplicate posts and i will have the fix for lower php versions in the install.

Slapyo 04-13-2004 09:00 PM

ok, i have fixed the duplicate post problem. it now inserts the data into the rss_feed and rss_date fields. it should check the post and not post it if it is a duplicate.

also, i have included in the rss_update.php file a section of commented code. if you use a version of PHP prior to 4.3.0 you will need to uncomment this section out, and then comment the 2 lines above it.

Slave 04-13-2004 09:08 PM

Thanks Slapuo .. :)

Any news about the \ problem?

(not tried 1.22 yet so don't know if still doing it :) .. yep it is)

Slapyo 04-13-2004 09:19 PM

i didn't do anything with the \' problem. i don't know what is causing that. i looked at your feed and it looks just like the one i use from yahoo. however, i do not have that problem in my code.

i looked and this seems to be the culprit

PHP Code:

$rss_title mysql_escape_string($rss_title);
$rss_description mysql_escape_string($rss_description); 

because in the function to insert the post it uses addslashes() ... so i think it is putting \\' instead of \' like it should. then it removes the \ and leaves the trailing \' ... i have just uploaded a new 1.22 try that one. if you don't want to download it. all i did was remove those 2 lines of code from the rss_update.php file.

SnowBot 04-13-2004 09:22 PM

hhhmm

All i get when running the task is this

rss.php

ChannelData($leftOvers,$x); } return; } /* * void parse ( string data ) */ function parse($data="") { $channels = $this->parseChannels($data); if(empty($channels)) { return; } $this->parseItems($channels); return; } /* * Finito */ } ?>nito */ } ?>d); } } } } // // ------------------------------ // End of RSS News Hack ?> $post['signature'] = true; $post['emailupdate'] = 9999; $post['title'] = $rss_title; $post['message'] = $rss_description; $post['poststarttime'] = TIMENOW; $post['rss_date'] = $rss_dateline; $post['posthash'] = md5($post['poststarttime'] . $bbuserinfo['userid'] . $bbuserinfo['salt']); // build the thread build_new_post('thread', $foruminfo, array(), 0, $post, $errors, $rss_userid); } } } } // // ------------------------------ // End of RSS News Hack ?>

now :(

any help, whats going on?

Slave 04-13-2004 09:23 PM

ok tar ..

I just had a play in the "Replacement Variable Manager" and added a new one to replace \' with ' and it seems to work :) .. but I'll also try your way too ..

:)

Slave 04-13-2004 09:27 PM

Quote:

Originally Posted by Slapyo
i didn't do anything with the \' problem. i don't know what is causing that. i looked at your feed and it looks just like the one i use from yahoo. however, i do not have that problem in my code.

i looked and this seems to be the culprit

PHP Code:

$rss_title mysql_escape_string($rss_title);
$rss_description mysql_escape_string($rss_description); 

because in the function to insert the post it uses addslashes() ... so i think it is putting \\' instead of \' like it should. then it removes the \ and leaves the trailing \' ... i have just uploaded a new 1.22 try that one. if you don't want to download it. all i did was remove those 2 lines of code from the rss_update.php file.

Just tried your latest change .. and it works :)

Also the duplicate problem has gone too it seems ..

Cheers ,., :D

Slapyo 04-13-2004 09:29 PM

@SnowBot ... are you in the scheduled tasks telling the script to run right now? or are you just letting it run on it's own? or are you just loading the rss.php file? i will look and see what i can find, but that code is from the original author and i haven't made any changes to it at all. i will see if i can find something. have you tried downloading the new version 1.22 and uploading that, overwriting all previous rss files?

@Slave ... i just uploaded a new fix for your problem. since i am not having the same problem on my machine i don't know if it works or not. could you try it out. you will have to remove your replacement variable for \' to see if it works. i think it will though, i think it was doubling up the \'s so it had \\' instead of \' like it should have.

Slave 04-13-2004 09:31 PM

Yeah .. tried it .. and it works .. :)

Slapyo 04-13-2004 09:32 PM

Quote:

Originally Posted by Slave
Just tried your latest change .. and it works :)

Also the duplicate problem has gone too it seems ..

Cheers ,., :D

ok good to know! thanks!

SnowBot 04-13-2004 09:35 PM

Yes this is from the task manager, when i hit the Run Task now button to see if its all working i get this.

I overwritten all the 1.21 files with the new 1.22 ones. NO post nothing :(

Slave 04-13-2004 09:36 PM

heh .. just installing it to my live forums now .. :)

Slapyo 04-13-2004 09:44 PM

Quote:

Originally Posted by SnowBot
Yes this is from the task manager, when i hit the Run Task now button to see if its all working i get this.

I overwritten all the 1.21 files with the new 1.22 ones. NO post nothing :(

i assume you have made a bot and given it the proper user id, forum id, and rss fed url?

what is the feed you are trying to use?


All times are GMT. The time now is 09:19 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01784 seconds
  • Memory Usage 1,869KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (4)bbcode_php_printable
  • (15)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete