Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'nokogiri'
- require 'open-uri'
- require 'sequel'
- require 'sqlite3'
- require 'pry'
- require 'uri'
- require 'cgi'
- 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
- genres_and_links = genres.zip(genre_links)
- binding.pry
- puts genres_and_links
- =begin
- Sequel.extension :core_extensions
- DB = Sequel.connect('sqlite://clublandlv.sqlite')
- DB.extension(:pg_array, :pg_row, :pg_hstore)
- Sequel.pg_array(genre_and_link)
- binding.pry
- # genre_and_link.pg_array
- # DB[:genres].insert(:column=>Sequel.pg_array([2, 3]))
- # main_genre.insert(:forum_id => genre_and_link)
- =end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement