• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

writing a forum post-counter...

Deeko

Lifer
Ok, we have a message board that is very primative, no post counts or anything, and its been requested that I write a post counter for it. Well, I wrote up a quick program that accepts a text file of posts and goes through and counts them...but thats horribly inefficient because then I'd have to copy and paste every thread into a text file. Is it at all possible to write something that will navigate to each thread automatically, download the text to that text file, and then run my original script on the file?
 
It's possible to write software that does anything you want.

What you should do is change your forum to increment a post counter every time someone posts a message.
 
That would make life most simple....but its not my forum. Its a message board on another website.

The main question....how do I go about having the software navigate to a page, download the text(or the html, that would work just as well), and then navigate to the next?
 
Parsing html for information is not cool (of course it's been done, but only for much more complicated things than post counts). Is there no way you can query their database?
 
Originally posted by: Deeko
That would make life most simple....but its not my forum. Its a message board on another website.

The main question....how do I go about having the software navigate to a page, download the text(or the html, that would work just as well), and then navigate to the next?

Something like this:

String start = "http://www.somesite.com";
lookupPages(start);

void lookupPages(string startPage)
{
String html = downloadPage(startPage);
string [] links = getlinks(html);
for(int ii = 0; ii < links.length; ii++)
{
lookupPages(links[ii]);
}
}


 
Its a database I'd imagine. I highly, highly doubt I'll get access to it though.

Here's the premise. There is a website called 'thefacebook.com'. It is a giant college directory basically. It supports 'groups' within your school...we have a group on there, that we use for its message board. The message board is, as I stated earlier, very primative. However, due to the scope of this entire website, I doubt I'd ever be allowed access to their db.
 
Originally posted by: notfred
Originally posted by: Deeko
That would make life most simple....but its not my forum. Its a message board on another website.

The main question....how do I go about having the software navigate to a page, download the text(or the html, that would work just as well), and then navigate to the next?

Something like this:

String start = "http://www.somesite.com";
lookupPages(start);

void lookupPages(string startPage)
{
String html = downloadPage(startPage);
string [] links = getlinks(html);
for(int ii = 0; ii < links.length; ii++)
{
lookupPages(links[ii]);
}
}

looks easy enough. downloadPage...is a function of what?
 
Originally posted by: Deeko
Originally posted by: notfred
Originally posted by: Deeko
That would make life most simple....but its not my forum. Its a message board on another website.

The main question....how do I go about having the software navigate to a page, download the text(or the html, that would work just as well), and then navigate to the next?

Something like this:

String start = "http://www.somesite.com";
lookupPages(start);

void lookupPages(string startPage)
{
String html = downloadPage(startPage);
string [] links = getlinks(html);
for(int ii = 0; ii < links.length; ii++)
{
lookupPages(links[ii]);
}
}

looks easy enough. downloadPage...is a function of what?

downloadPage() and getlinks() are excercises left to the reader.

In perl there is "get()" from the LWP::Simple module, In java there is URL.openStream(), and I'm sure there are other similar functions in whatever other language you might use to retrieve data from webpages. I don't know of any library functions that will parse your page for links, though.

Also, you'll need to create some method of storing links you've already visited, so that you don't load the same page twice.
 
notfred gave some good pseudocode - what you are looking for is basically a screen scraper...I've written a few, can be written in any language just about
 
Back
Top