Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clubland = "http://www.clublandlv.com/forum.php"
- doc = Nokogiri::HTML(open(clubland))
- doc.css("#c_cat10").each do |grab|
- genres = grab.css(".forumtitle").map(&:text)
- genre_links = grab.css(".forumtitle"){[:href]}
- genre_links = genre_links.map do |link|
- link_id = link.children.first["href"]
- CGI.parse(URI.parse(link_id).query)['f'].first.to_i
- end
- DB = Sequel.connect('sqlite://clublandlv.sqlite')
- # If i pass the argument to be .dinstinct matching the :genre table, i recieve a
- # DISTINCT ON not supported error. If i remove the argument, duplicates are inserted.
- genre_db = DB[:genres]
- genre_db.import([:genre, :genre_id], genres.zip(genre_links))
- end
Advertisement
Add Comment
Please, Sign In to add comment