google_movies47 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/google_movies47/parser.rb +7 -5
- data/lib/google_movies47/version.rb +1 -1
- metadata +1 -1
@@ -13,8 +13,6 @@ module GoogleMovies47
|
|
13
13
|
@genre_parser = GoogleMovies47::GenreParser.new(language)
|
14
14
|
@theaters = Hash.new
|
15
15
|
@movies = Hash.new
|
16
|
-
@theaters = []
|
17
|
-
@movies = []
|
18
16
|
end
|
19
17
|
|
20
18
|
def parse_show_times(doc)
|
@@ -22,18 +20,21 @@ module GoogleMovies47
|
|
22
20
|
"//div[@class='movie_results']/div[@class='theater' and .//h2/a]"
|
23
21
|
)
|
24
22
|
|
23
|
+
@theaters = []
|
24
|
+
y = 0
|
25
25
|
theater_elements.each do |t|
|
26
26
|
theater_name = t.search(".//h2[@class='name']/a/text()").text
|
27
27
|
theater_info = t.search(".//div[@class='info']/text()").text
|
28
28
|
showtimes = []
|
29
|
-
|
29
|
+
@movies = []
|
30
30
|
x = 0
|
31
|
+
movie_elements = t.search(".//div[@class='showtimes']//div[@class='movie']")
|
31
32
|
movie_elements.each do |m|
|
32
33
|
movie_name = m.search(".//div[@class='name']/a/text()").text.strip
|
33
34
|
movie_info_line = m.search(".//span[@class='info']/text()").text
|
34
35
|
movie_info = parse_movie_info(movie_info_line)
|
35
36
|
|
36
|
-
@movies
|
37
|
+
@movies[x] = { :name => movie_name, :info => movie_info } if @movies[x].nil?
|
37
38
|
|
38
39
|
movie_times = m.search(".//div[@class='times']/span/text()")
|
39
40
|
times = []
|
@@ -46,7 +47,8 @@ module GoogleMovies47
|
|
46
47
|
showtimes << { :name => movie_name, :language => movie_info[:language], :times => times }
|
47
48
|
end
|
48
49
|
|
49
|
-
@theaters
|
50
|
+
@theaters[y] = { :name => theater_name, :info => theater_info, :movies => showtimes }
|
51
|
+
y = y + 1
|
50
52
|
end
|
51
53
|
|
52
54
|
end
|