View Full Version : Searching Script

10-05-2011, 01:17 AM
Hey guys, I know very little java I took AP computer science in high school and have since forgotten most of it. I'm trying to write a code that :
What I'm trying to do is have a script that loads a website such as

and searches for a couple strings of words then if the strings aren't found
it searches the next one, =000002, If it finds the strings that are required
it would save the link or keep the page open and stop searching.
I'm honestly not sure where to start so I came looking for a little bit of a
shove in the right direction. Anybody with any ideas would be really


Old Pedant
10-05-2011, 01:34 AM
This is the javaSCRIPT forum. You can't do what you want in JavaScript (you can't load data from another site with JS), so I suspect you really do mean you want to use JAVA. About the only thing the two languages share are the first four letters of their names.

10-05-2011, 09:30 AM
are you trying to implement pattern search?

10-05-2011, 10:19 AM
I think you might want to install the add-on "Greasemonkey" for Firefox and start learning to use userscripts. You can do those kind of things with Greasemonkey easily.

Example for a userscript

// ==UserScript==
// @name Test for CF
// @namespace http://userscripts.org/users
// @description Test for CF
// @include http://www.anywebsite.com/showthread.php?t=*
// ==/UserScript==

// The header tells Greasemonkey on which pages it should run
// The code below will run as soon as the page has been loaded, no need for onload here

// customize wordlist here
var wordlist = ["word1", "word2"];
var found = true;
var source = document.body.innerText;

for(i=0; i<wordlist.length; i++) {
if(source.indexOf(wordlist[i]) == -1) {
// one of the words was not found
found = false;

if(!found) {
// if at least one of the words was not found, go to next page
// first extract the number
var theHref = window.location.href;
var theNextNumber = Number(theHref.substring(theHref.length-6))+1;
theNextNumber = '000000' + theNextNumber;
window.location.href = theHref.substring(0, theHref.length-6)+theNextNumber.substring(theNextNumber.length-6);