3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/bollywood/scraper.rb', line 3
def self.scrape_data
doc = Nokogiri::HTML(open('http://www.bollywoodmdb.com/movies/'))
doc.css(".mob_a").remove
doc.css("div.row.move-data.spacer").each do |m|
movie = Bollywood::Movie.new
movie.name = m.css("a.movie-link").first.text
movie.cast = m.css("a.aheight").collect {|c| c.text }
movie_date_synopsis = []
m.css("div.spacer.hidden-xs").each do |d|
movie_date_synopsis << d.text
end
movie.release_date = movie_date_synopsis[0]
movie.synopsis = movie_date_synopsis[1]
if movie.synopsis == nil
movie.synopsis = "There is no synopsis available!"
end
end
end
|