egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Grab 2 lines from WWW. Not working so good :S

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
cvanmeer
Halfop


Joined: 02 Dec 2003
Posts: 40
Location: The Netherlands

PostPosted: Sat Mar 06, 2004 5:27 am    Post subject: Grab 2 lines from WWW. Not working so good :S Reply with quote

Hi guys,

I want to strip some data from a webpage.
Now the problem is, the data I want, is always in de the same line, but not in the exact same place at all times.
My problems concerns 2 lines:

Line 1:
Code:
<tr><td bgcolor=#B8C5E2 align=right>&nbsp;</td><td bgcolor=#C9D3E9>Total number of page views up till now</td><td nowrap bgcolor=#C9D3E9>145683</td></tr>


Line 2:
Code:
<tr><td bgcolor=#B8C5E2 align=right>&nbsp;</td><td bgcolor=#C9D3E9>6 March 2004</td><td align=right bgcolor=#C9D3E9>342</td></tr>


I suspect line 1 is the easiest. I want to grab the total number of page views. In this example: 145683
The way I do this now (and not working correctly) is this:

Code:
 set url1 "http://www.nedstatbasic.net/s?tab=1&link=1&id=2532130"
 set temp1 [http::geturl $url1 -timeout 5000]
 set data1 [http::data $temp1]
 set stap1 [split $data1 \n]
 set l1stap2 [lindex $stap1 115]
 set l1stap3 [string range $l1stap2 0 [expr [strlen $l1stap2]-11]]
 set l1stap4 [string range $l1stap3 137 end]
 set hits $l1stap4


I think it has to be a sort of regexp, but I don't know how.

The second line is the most variable, because of the changing data in the line. In this example line I want to capture: 342

Could someone help me?

thx.

Chrizz
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber