说说采集

;界面
gui, add, text, x0 y0 w400 h80 vshow
gui, show
;编码
fileencoding,
;fileencoding, UTF-8
savepath = %A_ScriptDir%经典
IfNotExist, % savepath
	FileCreateDir, % savepath
Loop
{
;最大页数
if A_Index > 11
	Break
;获取列表
URLDownloadToFile, http://www.shuoshuokong.com/jingdian/list_5_%A_Index%.html, %A_Temp%list.html
;处理文字
FileRead, content, %A_Temp%list.html
FileDelete, %A_Temp%list.html
StringReplace, content, content, `r, , All
StringSplit, line, content, `n
Loop % line0
{
tmp_line := line%A_Index%
If RegExMatch(tmp_line,".*
.*title=""(.*)"".*href=""(/jingdian/d*.html).*",m) ;匹配文章页标题/连接 { title = %m1% url = http://www.shuoshuokong.com%m2% filename = %title% ;处理文件名特殊字符 Loop { if RegExMatch(filename,"(\|/|*|""|*|?|||)") filename := RegExReplace(filename,"(\|/|*|""|*|?|||)","") Else Break } filepath = %savepath%%filename%.txt GuiControl, , show, %url%`n%filepath% catchpage(url,filepath) ;传递给处理页面的函数 } } } MsgBox, 64, 提示, 已完成! ExitApp catchpage(page,file){ static i i++ ;下载 URLDownloadToFile, % page, %A_Temp%catch_%i%.tmp FileRead, content, %A_Temp%catch_%i%.tmp StringReplace, content, content, `r, , All StringSplit, line, content, `n main = ;文章从158行开始 Loop % line0 - 157 { index := A_Index+157 tmp_line := line%index% ;遇到结束标志收尾 if tmp_line =
{ ;替换html标签 Loop { if RegExMatch(main,"]*>") main := RegExReplace(main,"]*>","") Else Break } ;保存 FileAppend, %main%, %file% FileDelete, %A_Temp%catch_%i%.tmp Return } main .= tmp_line "`n" } }

给TA捐赠
共{{data.count}}人
人已捐赠
其他

试题随机组合

2020-3-9 5:35:44

其他教程

读取eml邮件文件

2020-3-9 5:37:44

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索