查看: 2398|回复: 0

下载臼井素材用脚本

[复制链接]

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2014-11-23 12:08:06 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 taroxd 于 2016-5-1 16:25 编辑

[pre lang="ruby"]require 'net/http'

list = %W[
rpg_actor_mv_m
rpg_actor_mv_f
rpg_actor_m
rpg_actor_f
rpg_actor_etc
rpg_icon
rpg_chadot4_10
rpg_chadot11_20
rpg_chadot21_30
rpg_chadot31_40
rpg_chadot41_50
rpg_chadot51_60
rpg_chadot61_70
rpg_chadot71_80
rpg_chadot81_90
rpg_chadot91_100
rpg_chadot101_110
rpg_chadot111_120
rpg_chadot121_130
rpg_chadot131_140
rpg_chadot141_150
rpg_chadot_etc
rpg_window
rpg_effect
rpg_map
rpg_kinotake_sozai
]

def usui_scan_dl html, type, re
  html.scan re do |(addr)|
    addr.sub!(/\A(http:\/\/usui.moo.jp|\.)/, '')
    addr.prepend '/' unless addr.start_with? '/'
    data = Net::HTTP.get 'usui.moo.jp', addr
    File.open("#{type}/#{File.basename addr}", 'wb') { |f| f.write data }
    puts "Downloaded: #{addr}"
  end
end

list.each do |type|

  Dir.mkdir type unless Dir.exist? type

  html = Net::HTTP.get('usui.moo.jp', "/#{type}.html")
  usui_scan_dl(html, type, /<img src=\"(.+?.png)\"/)
  usui_scan_dl(html, type, /<a href=\"(.+?.zip)\"/)
end

[/pre]

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本发帖返回顶部