xTurinx Posted August 10, 2014 Posted August 10, 2014 I know this is no web application but it is hopefully very usefull for people who wants to implement item icons with relation to their item entry in a web application project. Â Requirements: - ruby - bash/sh - wget #!/usr/bin/ruby require 'net/http' for i in 1..150000 url = URI.parse("http://wowhead.com/item=#{i}") req = Net::HTTP::Get.new(url.to_s) res = Net::HTTP.start(url.host, url.port) {|http| http.request(req) } line = res.body.split("n") for itr in 0..line.length if line[itr] != nil && line[itr] != '' && line[itr]["image_src"] part = line[itr].split(';') img = part[part.length - 1].split('"')[0] puts "Item: #{i} - Icon: #{img}" `cd icons && wget http://wow.zamimg.com/images/wow/icons/large/#{img}` `echo "INSERT INTO item_icon (item, icon) VALUES (#{i}, '#{img}')" >> dump.sql` end end end Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.