mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2006
Posts: 20
G
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Oct 2006
Posts: 20
howdy all,

i'm working on some code for the imdb search site... and i've pretty much got it worked out, except this one thing.... i'm trying to pull the casting info from the pages but the html code is extremly long and i'm not sure how to do it.. this is an actual piece of the string:
Code:
<hr/>
<img src="http://i.imdb.com/images/tn15/header_cast.gif" width="34" height="20" alt="Cast"><small style="position: relative; top: -5px">(Cast overview, first billed only)</small><div class="info"><table class="cast">  <tr class="odd"><td class="hs"><a href="/rg/title-tease/tinyhead/name/nm0000242/"><img src="http://ia.ec.imdb.com/media/imdb/01/I/57/23/48t.jpg" width="23" height="32" border="0"></a><br></td><td class="nm"><a href="/name/nm0000242/">Mark Wahlberg</a></td><td class="ddd"> ... </td><td class="char">Bob Lee Swagger</td></tr><tr class="even"><td class="hs"><a href="/rg/title-tease/tinyhead/name/nm0671567/"><img src="http://ia.ec.imdb.com/media/imdb/01/I/92/54/60/10t.jpg" width="23" height="32" border="0"></a><br></td><td class="nm"><a href="/name/nm0671567/">Michael Pe&#241;a</a></td><td class="ddd"> ... </td><td class="char">Nick Memphis</td></tr><tr class="odd"><td class="hs"><a href="/rg/title-tease/tinyhead/name/nm0000418/"><img src="http://ia.ec.imdb.com/media/imdb/01/I/51/25/22t.jpg" width="23" height="32" border="0"></a><br></td><td class="nm"><a href="/name/nm0000418/">Danny Glover</a></td><td class="ddd"> ... </td><td class="char">Colonel Isaac Johnson</td></tr><tr class="even"><td class="hs"><a href="/rg/title-tease/tinyhead/name/nm0544718/"><img src="http://ia.ec.imdb.com/media/imdb/01/I/95/85/58t.jpg" width="23" height="32" border="0"></a><br></td><td class="nm"><a href="/name/nm0544718/">Kate Mara</a></td><td class="ddd"> ... </td><td class="char">Sarah Fenn</td></tr><tr class="odd"><td class="hs"><a href="/rg/title-tease/tinyhead/name/nm0000480/"><img src="http://ia.ec.imdb.com/media/imdb/01/I/44/03/32/10t.jpg" width="23" height="32" border="0"></a><br></td><td class="nm"><a href="/name/nm0000480/">Elias Koteas</a></td><td class="ddd"> ... </td><td class="char">Jack Payne</td></tr><tr class="even"><td class="hs">
 


i found a similar post by searching the forums... but i dont understand one lick of it.. i'm using this piece of code to parse the rest of the info on the pages:
Code:
alias  _htmlconv {
  var %x = $regsubex($1-,/(?:&#(\d*?);)/g,$chr(\t))
  noop $regsub(%x,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x)
  return $remove(%x,&,$chr(9))
}
 

but i'm pretty sure that wont or can't handle what i want to do here..i'm pulling the info from the page and writing it to file using bwrite from the sockread and then calling the info from the file into hash table using the fread and fseek commands. ex:
Code:
on *:sockread:blank:{
  if ($sockerr) { Halt }
  sockread -f &a
  bwrite file.dat -1 -1 &a
}
on *:sockclose:blank:info

alias info {
  var %table = $remove(%title,$chr(32)) $+ .hsh
  .fopen imdb file.dat
  .fseek -w imdb *<h5>Directed by</h5>*
  noop $fread(imdb)
  hadd %table Director $_htmlconv($fread(imdb))
.fclose imdb
}
 

and from there i use another alias to input the info i want into a dialog from the hash table...
so if anyone would be willing to help with this.. it would be greatly appreciated..

thanks in advance

Joined: Oct 2006
Posts: 20
G
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Oct 2006
Posts: 20
well, if someone could at least steer me in the right direction that would be really cool whistle

Last edited by ghettowboy; 03/04/07 01:30 PM.
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
patience is a virtue!

and I'm sure there is someone who might be able to help you.

to start out: try searching for existing scripts on the many script websites that are out there...


If it ain't broken, don't fix it!
Joined: Oct 2006
Posts: 20
G
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Oct 2006
Posts: 20
Originally Posted By: Doqnach
patience is a virtue!

and I'm sure there is someone who might be able to help you.

to start out: try searching for existing scripts on the many script websites that are out there...


i've tried that.. seems there's only one script out there remotely close to what i'm doing but, its very difficult to understand .....

i've come across a couple of posts by FiberOPtics and MPDreamz.. that talk about using binvars and being able to go thru chunks of the code then continuing from pos.. ?? i've been trying to follow that but having a hard time with this.. for starters i cant figure out how to set the bvar .... i've been trying to do this while the files are open using existing code.. i'm not if i can do that even.. this is like being a taste tester with having no tastebuds... crazy


Link Copied to Clipboard