找回密码
 加入
搜索
查看: 2209|回复: 2

[IE类操作] 留言板留言读取[已解决]

[复制链接]
发表于 2010-3-1 17:10:13 | 显示全部楼层 |阅读模式
本帖最后由 lanfengc 于 2010-4-9 16:08 编辑
#include <INet.au3>
$File=InetGet("http://58.ieeie.com/58/book.aspx?username=lanfenglovec",@TempDir&"\temp.htm",1,0)
$Code=FileRead(@TempDir&"\temp.htm" )
$Code=StringSplit($Code,"查看留言",1)
$Code=StringSplit($Code[2],"首页",1)
$Code=StringSplit($Code[1],"STYLE33",1)
MsgBox(0,"总留言条数为",$Code[0])

For $i=2 To $Code[0] Step 1
        $Fir=StringSplit($Code[$i],'STYLE29"'&'>',1)
        $1=StringSplit($Fir[1],"</sp",1)
        $1=StringTrimLeft($1[1],5)
        $2=StringSplit($Fir[2],"</sp",1)
        $2=StringTrimLeft($2[1],5)
        MsgBox(0,$1,"留言内容:"&$2)
Next
发表于 2010-3-1 17:52:44 | 显示全部楼层
InetGet("http://58.ieeie.com/58/book.aspx?username=lanfenglovec", @TempDir & "\temp.htm", 1, 0)
$Code = FileRead(@TempDir & "\temp.htm")
$ID = StringRegExp($Code, '网友留言:([^<]+)</', 3)
If @error Then Exit MsgBox(0, 0, '错误1')
$str = StringRegExp($Code, 'STYLE29">\s+([^<]+)\r\n</span><', 3)
If @error Then Exit MsgBox(0, 0, '错误2')
Dim $out = ''
For $i = 0 To UBound($ID) - 1
        $out &= 'ID:' & @CRLF & $ID[$i] & @CRLF & '内容:' & @CRLF & $str[$i] & @CRLF & @CRLF
Next
MsgBox(0, '共 ' & UBound($ID) & ' 条留言', $out)
 楼主| 发表于 2010-3-5 21:14:13 | 显示全部楼层
回复 2# afan


    AFAN 正则厉害  顶一个。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-7-3 07:17 , Processed in 0.076043 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表