赞 | 3 |
VIP | 333 |
好人卡 | 2 |
积分 | 1 |
经验 | 1450446 |
最后登录 | 2019-5-29 |
在线时间 | 615 小时 |
Lv1.梦旅人 66RPG站长
- 梦石
- 0
- 星屑
- 54
- 在线时间
- 615 小时
- 注册时间
- 2005-10-10
- 帖子
- 5734
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
这几天想找一些文章读,本想从起点上面找,结果发现起点实际上是不支持按字数搜索的——可能支持,但是至少就我看到的不是很方便,没有找到。
所以想,干脆把起点文学所有完结版作品的文章列表下载一份回来自己找……
于是就有了这么个脚本:
- #---------------------------------------------------
- # 本脚本来自www.66rpg.com = =b
- #---------------------------------------------------
- $allartsnumber = 9304 # 总文章数,手动输入
- #------------------------------------------------------------------------------
- # Moonlight INN
- # http://cgi.members.interq.or.jp/aquarius/rasetsu/
- # RaTTiE
- # [email protected]
- #------------------------------------------------------------
- # EasyConv::s2u(text) : S-JIS -> UTF-8
- # EasyConv::u2s(text) : UTF-8 -> S-JIS
- #==============================================
- module EasyConv
- # API梡掕悢掕媊
- CP_ACP = 0
- CP_UTF8 = 65001
- #--------------------------------------------------------------------------
- # 仠 S-JIS -> UTF-8
- #--------------------------------------------------------------------------
- def s2u(text)
- # API掕媊
- m2w = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
- w2m = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
- # S-JIS -> Unicode
- len = m2w.call(CP_ACP, 0, text, -1, nil, 0);
- buf = "\0" * (len*2)
- m2w.call(CP_ACP, 0, text, -1, buf, buf.size/2);
- # Unicode -> UTF-8
- len = w2m.call(CP_UTF8, 0, buf, -1, nil, 0, nil, nil);
- ret = "\0" * len
- w2m.call(CP_UTF8, 0, buf, -1, ret, ret.size, nil, nil);
-
- return ret
- end
- # module_function偲偟偰岞奐
- module_function :s2u
- #--------------------------------------------------------------------------
- # 仠 UTF-8 -> S-JIS
- #--------------------------------------------------------------------------
- def u2s(text)
- # API掕媊
- m2w = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
- w2m = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
- # UTF-8 -> Unicode
- len = m2w.call(CP_UTF8, 0, text, -1, nil, 0);
- buf = "\0" * (len*2)
- m2w.call(CP_UTF8, 0, text, -1, buf, buf.size/2);
- # Unicode -> S-JIS
- len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil);
- ret = "\0" * len
- w2m.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil);
-
- return ret
- end
- # module_function偲偟偰岞奐
- module_function :u2s
- end
- #========================================
- # 本脚本来自www.66rpg.com
- #========================================
- class Get_Http_Info
-
- AGENT = "RGSS PLAYER"
- INTERNET_OPEN_TYPE_PRECONFIG = 0 # IEの設定を仕様
- INTERNET_OPEN_TYPE_DIRECT = 1 # プロキシを使用しない
- def Get_Http_Info.InternetOpen()
- io = Win32API.new('wininet', 'InternetOpen', %(p, l, p, p, l), 'l')
- hInternet = io.call(AGENT, INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0)
- return hInternet
- end
- def Get_Http_Info.InternetOpenUrl(hSession, url)
- iou = Win32API.new('wininet', 'InternetOpenUrl', %(l, p, p, l, l, l), 'l')
- hService = iou.call(hSession, url, nil, 0, 0, 0)
- return hService
- end
- def Get_Http_Info.InternetReadFile(hService)
- content = ""
- read_size = 1024 # 一次读入文件的尺寸
- irf = Win32API.new('wininet', 'InternetReadFile', %(l, p, i, p), 'i')
- while(true)
- buf = "\0" * read_size
- red = [0].pack('L')
- irf.call( hService, buf, read_size, red )
- if(red.unpack('L') == [0])
- #读到文件末端
- break
- end
- buf.delete!("\0")
- content += buf
- end
- return content
- end
- HTTP_QUERY_STATUS_CODE = 19
-
- def Get_Http_Info.HttpQueryInfo(hService)
- read_size = 1024
- buf = "\0" * read_size
- red = [read_size-1].pack('L')
- hqi = Win32API.new('wininet', 'HttpQueryInfo', %(l, l, p, p, p), 'i')
- isOk = hqi.call( hService, HTTP_QUERY_STATUS_CODE, buf, red, nil)
- buf.delete!("\0")
- return buf
- end
- def Get_Http_Info.InternetCloseHandle(hInternet)
- ich = Win32API.new('winInet', 'InternetCloseHandle', %(l), 'i')
- isOk = ich.call(hInternet)
- return isOk
- end
- HTTP_CODE_OK = "200"
-
- def Get_Http_Info.get_info(url)
- info = nil
- begin
- hInternet = InternetOpen()
- if(hInternet != 0)
- hService = InternetOpenUrl(hInternet, url)
- if(hService != 0)
- status_code = HttpQueryInfo(hService)
- if(status_code == HTTP_CODE_OK)
- info = InternetReadFile(hService)
- end
- InternetCloseHandle(hService)
- end
- InternetCloseHandle(hInternet)
- end
- rescue
- # 例外发生
- return nil
- end
-
-
- $ary = ""
-
- info.each_line do |line|
- $ary += EasyConv.s2u(line)
- end
-
- for i in 2..60
- a = $ary.split(/putlist/)[i]
- a = a[1, a.size - 3]
- $fr.write(a + "\n")
- end
- Graphics.update
-
- $next_page = "http://www.cmfu.com/listbookqb.asp?pageid=" + $ary.split(/listbookqb.asp\?pageid=/)[1].split(/'/)[0]
-
- end
-
- def Get_Http_Info.sendAnswers
- a = ""
- a = $game_variables[5].to_s + $game_variables[4].to_s + $game_variables[3].to_s + $game_variables[2].to_s + $game_variables[1].to_s
- b = ""
- b = $game_variables[10].to_s + $game_variables[9].to_s + $game_variables[8].to_s + $game_variables[7].to_s + $game_variables[6].to_s
-
- c = "http://rpg.blue/friends66as.asp?a=#{a}&b=#{b}"
- $bb_66rpg = Win32API.new('shell32.dll','ShellExecuteA',%w(p p p p p i),'i')
- $bb_66rpg.call(0, 'open', c ,0, 0, 1)
- end
- end
- $ary = nil
- $now_page = 1
- $sprite = Sprite.new
- $sprite.bitmap = Bitmap.new(320,240)
- $all_ys = $allartsnumber / 60
- $sprite.bitmap.draw_text(0,0,256,32,"正在获得起点文章列表……")
- $sprite.bitmap.draw_text(0,32,256,32,"第 "+$now_page.to_s+" 页,共 " + $all_ys.to_s + " 页")
- $next_page = "http://www.cmfu.com/listbookqb.asp?status=down"
- $fr = File.open("alltext.txt","wb")
- $fr.write("'地址编号','作者','书名','日期','最后章节','字数','作者ID','类别','章节地址'" + "\n")
- for $now_page in 1..$all_ys
- ver = Get_Http_Info.get_info($next_page)
- $sprite.bitmap.clear
- $sprite.bitmap.draw_text(0,0,256,32,"正在获得起点文章列表……")
- $sprite.bitmap.draw_text(0,32,256,32,"第 "+$now_page.to_s+" 页,共 " + $all_ys.to_s + " 页")
- Graphics.update
- end
- $fr.close
- p "文章读取完毕,请查看alltext.txt","处理方法:使用excel打开,然后再去调整和排序即可"," ","找到想要看的书的地址编号,然后输入:","http://www.cmfu.com/showbook.asp?bl_id=编号"
复制代码
运行之后的结果:
1、文本文件:http://rpg.blue/web/ftppic/web3/200701/alltexttxt.rar
2、EXCEL文档:http://rpg.blue/web/ftppic/web3/200701/alltextxls.rar
由于起点是在不断更新的,这个小脚本可能过一段时间后会失效,故保留地球村区好了。上面可以下载的两个列表是截止发帖时候的全部列表。 |
|