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)
-   -   RSS News Feed Hack (https://vborg.vbsupport.ru/showthread.php?t=60899)

KuraFire 02-03-2004 08:02 PM

Cron job is much safer and nicer to do this with :)

NuclioN 02-03-2004 08:36 PM

Is there a way to pull the news from RSS into the postbit itself when you click a link? I've seen it before but i don't know how they do that.

sjau 02-03-2004 10:01 PM

Xyphen:

I have another three things in mind:

1.) Add in the admin section a name to each feed so that you only have to create one user-bot but you can distinguish them by the name given in the AdminCP and the name given in the AdminCP should then also be used as username when wwriting data to mysql.

e.g. I currently pull data from NZZ Online, from NZZ Wirtschaft, 20min Ausland, AltaVista and Google.de

I currently have for each news service another user setup but I think I should be able to do it with one user only that can be distinguished in the admin and forum section.

2.) You use in in code "<br><br>" do make row breaks. Maybe you could check whether on this board HTML is enabled and if not use "\n\n" instead and "View full article" could be a phrase so that it can be translated easily into other languages.

3.) Increase forum counts when news are added and decrease forum counts when they are deleted.
Maybe adding also a feature that deletes news older than xx days.

Anyway, great work so far and I would help you out but my skills aren't as advanced as yours although I'm learning.

wolfstream 02-04-2004 07:47 AM

Code:

  for($i = count($rss_allItems) - 1; $i >= 0; $i--) {
            $rss_allItems[$i][OLD] = false;
        }

That fixed the problem right up, indeed.

Now, there are a couple more things that are issues. For one there's no check for mysql_escape_string which will be bad if you actually grab rss feeds from, say a site that uses " or '. I've already run into this one tonight;
Fix:
In includes/RSS/rss_update.php, look for
Code:

$rss_title = str_replace("&apos;", "\'", $rss_title);
$rss_description = str_replace("&apos;", "\'", $rss_description);

and change it to:
Code:

        $rss_description=mysql_escape_string($rss_description);
        $rss_title=mysql_escape_string($rss_title);
//        $rss_title = str_replace("&apos;", "\'", $rss_title);
//        $rss_description = str_replace("'", "\'", $rss_description);

Essentially, this is the same thing, but for some reason the replace &apos; doesn't work as it should, in the longrun. I noticed this when I got feedback from the next script which I'll post:

In response to the cron thing, it's really a simple thing to do (until this is officially added to the cron somehow). Create a file in your public_html, call it rssfeed.php (or whatever), and in it, just add:
Code:

<?
require_once('./global.php');
require_once('./includes/functions_bigthree.php');
require_once('./includes/functions_forumlist.php');
require_once('./includes/RSS/rss_update.php');
?>

and for a cron entry, just call
Code:

*/5 * * * * php /path/to/your/file/rssfeed.php
This will update the news feeds every 5 minutes, rather than every time someone visits the forum, which would be more efficient. 5 minutes may (still) be too much, but I doubt it.

BTW, i've integrated this into vbadvanced, for those wanting info on how, let me know and if there's enough interest I'll post it here.

As far as forums and counts, I agree this is something that shouldn't be updated. However, if you (really) want to update your forums and posts, having this count in them, you can update your postcounts from admincp. This will fix that problem. Hopefully, I'll be able to come up with a workaround for that in the near future, but who knows.

Great code, glad to see it finally working!!

wsjb78 02-04-2004 08:01 AM

I'd be interested to know how you did that integrate into vbAdvanced. I've installed now vbIndex 3.0.x and also vbAdvanced but I only have troubles with certain things in vbIndex so I assumbe I'll stick to vBadvanced.

Btw, my code change (true --> false) was quite simple if you look at the logic of what is approved and not. I was looking first at the wrong spot either but basically if you set it to "true" it marks all fetched news items from the feed as [old], then if there are no items in the db it markes them all as [new], and then it fetches the items from the database and marks duplicate entries as [old] (which they already were).

Regarding the Cron:
How does it work? Those vB crons aren't really added to the system crontab right?

Does it check everytime when a vB page is called whether one of the specified crons if overdue and then execute it?

wolfstream 02-04-2004 08:15 AM

I'll get together tonight or in the next couple of days and put a hack together. It certainly wasn't a 3 or 4 line edit and I'm almost positive I missed something in there. Once I'm sure it works, I'll post it.

As far as cron, it's not added to the user's crontab (vbulletin isn't), no. In fact, I'd bet you'd run into the same problem there too, because it is called every time the page updates, so your best answer would be to create the file and call it via cron however often you want it to. I'm only a beginning hack however (as far as vb is concerned), haven't played with the cron stuff too much (yet).

sjau 02-04-2004 03:57 PM

you're code works fine :)

mcyates 02-07-2004 08:33 PM

Where can i find news feeds for soccer/football

mcyates 02-08-2004 08:10 AM

When the news is updating i always get this error. Obviously with a different storyline.

Database error in vBulletin 3.0.0 Release Candidate 4:

Invalid SQL: INSERT INTO post (`threadid`, `username`, `userid`, `title`, `dateline`, `pagetext`, `allowsmilie`, `showsignature`, `visible`) VALUES ('21596', 'News Poster', '3137', 'Stevenage 0-1 Telford', '1076235015', 'Stevenage's hopes of closing the gap on the play-off places suffered a blip as they crashed 1-0 at home to Telford.<br><br>View the Entire Article
', '1', '1', '1')
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 's hopes of closing the gap on the play-off places suffered a bl

mysql error number: 1064

Date: Sunday 08th of February 2004 05:10:18 AM
Script: http://www.myfootballforum.com/forumdisplay.php?f=318
Referer: http://www.myfootballforum.com/index.php?
Username: boro_boy
IP Address: 62.254.64.9

mcyates 02-08-2004 08:32 AM

now my sites, stopped working. I'm running RC4


All times are GMT. The time now is 04:18 PM.

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.01165 seconds
  • Memory Usage 1,747KB
  • 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
  • (5)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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