A simple little program I wrote that finds every forum in the range you set. Extremely slow because it's not multi-threaded, but I'm learning multithreading as soon as possible.
Currently, it can scan a rage of 2,000 forums in around five minutes.
Why did I make this? Mostly for fun, Charles kind of inspired me to do it, but it's also kind of a useless program.
Right now output is messy as hell (It outputs the entire "cookie crumbs" (as it was called in early web 2.0) HTML instead of just the forum name. This is kind of useless, but I don't care because I didn't make this program so it would look nice.
It does have a nice little self-updating text-gui thingy though, which is a first for me.
Anyway, enjoy! Should be thrown up on GitHub within a few days too.
Code:import java.util.*; import java.io.*; import java.io.UnsupportedEncodingException; import org.apache.commons.lang3.StringUtils; class GaiaForumFinder { public static void main(String[] args) { //Gaia Forum Finder //Made by 323 //Last Updated: July 23rd, 2013 HTTPRequest request = new HTTPRequest(); //Set the URL. All we'll do is affix 0 on it, and +1 it in a loop request.setURL("http://www.gaiaonline.com/forum/moderators/"); int maxforum = 2000; //Max forum searched value. Edit if necessary. int startforum = 1; //Makes it start at forum 0. Change if you want to, say, scan from 2000-3000. int current = startforum; //The current forum String source = ""; //The page source int forumsfound = 0; //Number of forums found try { PrintWriter out = new PrintWriter(new FileWriter("ForumNames.txt")); while(current < maxforum) { request.setURL("http://www.gaiaonline.com/forum/moderators/" + current); //Set the URL to the current forum source = request.get(); //GET the page source String forum = StringUtils.substringBetween(source, "<span class=\"linklist\"", "</span>"); //It will copy a lot of junk HTML, but I don't care if (forum != null ) { forumsfound++; //Add one to the number of forums found System.out.print('\u000C'); //Clears the terminal to refresh number of forums found out.println(current + " : " + forum); //Save forum + forum number to ForumNames.txt System.out.println("Number of forums found: " + forumsfound); //Print out the current number of forums found } else { System.out.print('\u000C'); //Clears the terminal to refresh the number of forums found System.out.println("Number of forums found: " + (forumsfound+1)); //Print out the current number of forums found } System.out.println("Number of forums searched: " + (current+1) + " out of " + maxforum); current++; } out.close(); } catch ( IOException error ) { System.err.println( "Error writing to output file: " + error ); } } }
Results 1 to 1 of 1
Thread: [Gaia] Forum Finder
- 24 Jul. 2013 03:00am #1
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 0.25
[Gaia] Forum Finder