Sha256: d5e9cc2b7f9bd8de90f51c4c025b2c200c4fe8db57616988c706af6b3a6ee0b0
Contents?: true
Size: 827 Bytes
Versions: 5
Compression:
Stored size: 827 Bytes
Contents
# encoding:utf-8 module Javlibrary def Javlibrary.genres response = Mechanize.new; genres = Array.new begin response.get "http://www.jav11b.com/cn/genres.php" rescue retry end Nokogiri::HTML(response.page.body).search('//div[@class="genreitem"]/a').each do |row| genres << row.children.text end genres.uniq end def genres_insert client = Javlibrary.client genres = genres() genres.each do |e| begin client.query("INSERT INTO category (category_name) VALUES ('#{e}')") rescue next end end client.close end module_function :genres_insert end Javlibrary::genres_insert
Version data entries
5 entries across 5 versions & 1 rubygems