;预配置项 url_l = http://www.qisuu.com/soft/sort01/index_ id = 2 ;初始页码 maxid = 255 ;最大页码 url_r = .html site = http://www.qisuu.com kind = 玄幻奇幻 ;分类 1玄幻奇幻_289 2武侠仙侠_211 3女频言情_792 4现代都市_255 5历史军事_141 6游戏竞技_99 7科幻灵异_154 #NoEnv OnExit, exit ;初始化连接数据库 以便反复查询 DBFileName := A_ScriptDir . "qisuu.db" global DB DB := new SQLiteDB If !DB.OpenDB(DBFileName) { MsgBox, 16, SQLite错误, % "消息:`t" . DB.ErrorMsg . "`n代码:`t" . DB.ErrorCode ExitApp } ;首先检查初始化 if !IsObject(Query("select 1 from sqlite_master where name='novel'")) ;检查novel表 Exec("CREATE TABLE ""novel"" ( ""kind"" TEXT(255), ""name"" TEXT(255), ""author"" TEXT(255), ""size"" TEXT(255), ""class"" TEXT(255), ""url"" TEXT(255), ""image"" TEXT(255), ""description"" TEXT(255), ""download"" TEXT(255), ""creat_date"" TEXT(50), ""id"" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL)") Loop % maxid-id { list := URLDownloadToVar(url_l id url_r,"gb2312") ;抓取小说列表 a := StrSplit(list,"`n","`r") ;分割行为数组 a_id = 465 ;直接跳到正文 Loop { a_id++ if (a_id>a.maxindex()) break ;抓取文章信息 if (RegExMatch(a[a_id],"s+<[^>]*>作者:([^<]*)<[^>]*>大小:([^<]*)<[^>]*>等级:<em class=""lstar(d)""><[^>]*><[^>]*>更新:([^<]*)<[^>]*>",b) || RegExMatch(a[a_id],"s+<[^>]*>作者:<[^>]*>([^<]*)<[^>]*><[^>]*>大小:([^<]*)<[^>]*>等级:<em class=""lstar(d)""><[^>]*><[^>]*>更新:([^<]*)<[^>]*>",b)) { author:=b1,size:=b2,class=b3,creat_date:=b4 a_id++ if (RegExMatch(a[a_id],"s+<a href=""([^""]*)""><img src=""([^""]*)""><[^>]*><[^>]*>([^<]*)<[^>]*><[^>]*><[^>]*>",c) || RegExMatch(a[a_id],"s+<a href=""([^""]*)""><img src=""([^""]*)"">([^<]*)<[^>]*>",c)) { url:=site c1,image:=site c2,name:=c3 a_id++ RegExMatch(a[a_id],"s+<div class=""u"">([^<]*)</div>",f) description := f1 page := URLDownloadToVar(url,"gb2312") ;获取详细页的下载地址 d := StrSplit(page,"`n","`r") Loop % d.maxindex() { if RegExMatch(d[A_Index],"s+<a class=""downButton"" href='([^']*)' title=""[^""]*"">RAR格式下载</a>",e) { download:=e1 ToolTip % id "页:" name Exec("INSERT INTO ""novel"" (""kind"", ""name"", ""author"", ""size"", ""class"", ""url"", ""image"", ""description"", ""download"", ""creat_date"") VALUES ('" kind "','" name "','" author "','" size "','" class "','" url "','" image "','" description "','" download "','" creat_date "')") ;插入数据库 break } } } } } id++ } MsgBox, Ok exit: DB.CloseDB() DB = ExitApp
62 queries in 1.897 seconds |
avel 2016年5月30日 的 09:17
怎么已运行就提示没有找到SQLite3.dll. 目录下面明显都有的。