This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Data from web.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Data from web.

Post by iamdeath »

Hi guys, while using this proc in one of my script I am getting an error and I am confused how to get rid of it. I've tried all the possible ways I knew but I think I can't make it done without you guys help. Here is the code:

Code: Select all

  proc your_callbackproc {sock} {
    global url nick2msg
    putlog "Getting scores on the request of $nick2msg"
    set headers [egghttp:headers $sock]
    set body [egghttp:data $sock]
    regsub -all "\n" $body "" body
    regsub -all -nocase {<br>} $body "<br>\n" body
    regsub -all {<b>} $body "\n\002" body
    regsub -all {</b>} $body "\002" body
    regsub -all {Cricinfo} $body "\00304#Cricket\003 @ \00304Undernet\003" body
    regsub -all {at } $body " at " body
    regsub -all {World Cup Warm-up Matches} $body "\00304,01World Cup Warm-up Matches\003" body
    regsub -all {<p class="blueBackHeading">} $body "\n\00300,12" body
    regsub -all {</p>} $body "\003\n" body
    regsub -all { } $body "" body
    regsub -all {This page automatically refreshes every 90 seconds.} $body "" body
    regsub -all {Scorecard} $body "" body
    regsub -all {Desktop scorecard} $body "" body
    regsub -all {Bulletin} $body "" body
    regsub -all {3D Animation} $body "" body
    regsub -all {Match home} $body "" body
    regsub -all {\|} $body {} body
    regsub -all {<.+?>} $body "" body

    [msgnick $body]
}
The error I am getting is:

Code: Select all

[08:20] <Cricket`->  #Cricket @ Undernet - Desktop Scoreboard        function init(){	if(parent.adjustIFrameSize) 		parent.adjustIFrameSize(window);		//alert(parent.adjustIFrameSize);}//window.onload = init;        
[08:20] <Cricket`->    Current time:   03:20 GMT, Fri Apr 04, 2008
The site I am using to fetch the data from is:

Code: Select all

set url "http://content-pak.cricinfo.com/ci/engine/current/match/scores/liveframe.html"
Rest everything is working fine, below that error I am getting what I should, it works but just that function bla bla thingie bugs the crap out of me.

your help will be appreciated.

Thanks and peace
iamdeath
|AmDeAtH @ Undernet
Death is only the *Beginning*...
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

regsub -all -- {<script.*?>.*?</script>} $body "" body
It's the javascript. Strip it out as well with the above regsub. Place this regsub anywhere before this line: regsub -all {<.+?>} $body "" body
also on loading that page, appears it refreshes at 60 seconds.

Code: Select all

regsub -all {This page automatically refreshes every 90 seconds.} $body "" body 
You probably need to alter this as well. ;)
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Thanks alot, it works like a charm.. Thank you soo much. but I did'nt understand what you meant by your other suggestion, the 90 seconds thing.. can you tell me more about it if something is there, becuase that has no issues :)


one more thing to ask you how to eliminate this type of error through regsub:

Code: Select all

[08:26] <Cricket> <div style="float:left;padding-left:10px;">Developed by David Kendix</div>Last updated: Mar 22, 2008</div><div class="rankings_bottom_text">* The weighting of 'matches' is reduced over time so does not reflect the full number of matches played in the
I tried this but did'nt work:

Code: Select all

regsub -all "<div style=\"float:left;padding-left:10px;\">" $info " " info
Thanks

peace
death
|AmDeAtH @ Undernet
Death is only the *Beginning*...
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

regsub -all -- {<div .*?>} $body "" body
regsub -all -- {</div>} $body " " body
perhaps something like this? ;)


Not sure if by 'error' you mean: 1) just removing the html tags themselves, or 2) removing what is between the <div>...</div>

So the code above simply meets condition 1 above. Place it before this line: regsub -all {<.+?>} $body "" body 8)
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Thanks alot speechless I will try your code too but this worked:

Code: Select all

regsub -all "<div style=\"float:left;padding-left:10px;\">" $info " " info
The reason it was'nt working was because I was'nt putting it into the right place, but I will put your one too, that's short and better for div* type of errors..

Thanks speechless :D

peace
death
|AmDeAtH @ Undernet
Death is only the *Beginning*...
Post Reply