Gossamer Forum
Home : General : Perl Programming :

How do I parse a search results page?

Quote Reply
How do I parse a search results page?
I am currently working on a metasearch script which uses search modules. I know or at least I think I know how to put in the url$ and name$ but the parse$ is giving me problemsMad. I found a search script named Bolt search. I am trying to add links search to it and other search engines that I am affiliated with. The script is located on my web site at http://searchat.virtualave.net/mometa/srchen.cgi
the mods look like this
Code:
$senam = "SearchAt!-Web Business Services Directory";
$url = "http://webbusinessservices.virtualave.net/cgi-bin/links/search.cgi?query=$FORM2{'q'}";
$parse = "<A.*?href=\"(http://.*?)\" Target=\"_blank\">(.*?)</a>\n</td>\n</tr>\n</table>\n.*?<span class=\"descript\">- (.*?)</span>";
I know the parse$ is not correct and I have tried other ways but it still does not come up. It keeps returning a 0 results. If someone could help or teach me on how to setup a parse string and when to use and not to use sub fintou string and how to program that I would really appreciate it. for example on northern light
Code:
$senam = "NorthernLight";
$url = "http://northernlight.com/nlquery.fcg?qr=$FORM2{'q'}";
$parse = "<TD align=right valign=top><FONT size=2 face=arial,helvetica>.*?</FONT></TD>
<TD valign=top><FONT size=2 face=arial,helvetica>.*?<A href=\"(.*?)\">(.*?)</A><BR><IMG src=/gif/t.gif width=1 height=2><BR>.*?<B>.*?</B>(.*?)<BR>.*?<B>.*?</B>.*?<BR>";
sub fintou {
$v3 =~ s/date not available$//ig;
$v3 =~ s/..\/..\/....$//ig;
}
Thanks in advanceSmile
MetaSearchAt! and SearchAt! Directory
http://metasearchat.com
Subject Author Views Date
Post How do I parse a search results page? searchat 1929 Nov 6, 2001, 7:12 PM