Skip to content

Instantly share code, notes, and snippets.

@kohgpat
Created May 18, 2012 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kohgpat/2724777 to your computer and use it in GitHub Desktop.
Save kohgpat/2724777 to your computer and use it in GitHub Desktop.
Peoples Cinema - Movies and Shows
# encoding: UTF-8
require 'nokogiri'
require 'open-uri'
require 'colorize'
doc = Nokogiri::HTML(open('http://www.peoplescinema.ru/cgi-bin/i10.cgi'))
puts "Peoples Park\n".colorize(:blue)
doc.css('p.rs1 a.ax2').each do |movie|
places = []
movie.parent.parent.next_element.children.each do |children|
places << children.content if children.content.include? "Зал"
end
print "#{movie.content} ".colorize(:green)
places.each do |place|
print "#{place.split[0]} #{place.split[1][0]}".colorize(:white)
place.split[1..place.split.length].each do |time|
if time == place.split[1..place.split.length][0]
print " #{time.slice(1..time.length).slice(0..1)}:#{time.slice(1..time.length).slice(2..3)}"
else
print " #{time.slice(0..1)}:#{time.slice(2..3)}"
end
end
print " "
end
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment