yayimdbs 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/yay_imdbs.rb +5 -4
  2. metadata +3 -3
@@ -35,6 +35,7 @@ class YayImdbs
35
35
  :language => :languages,
36
36
  :motion_picture_rating_mpaa => :mpaa,
37
37
  :official_sites => :official_site}
38
+ OFFICAL_SITE_REGEX = /<a href="([^"]+)"[^>]*>Official site<\/a>/
38
39
 
39
40
  class << self
40
41
 
@@ -97,7 +98,7 @@ class YayImdbs
97
98
  info_hash[:video_type] = video_type_from_meta(doc)
98
99
 
99
100
  info_hash[:plot] = doc.xpath("//td[@id='overview-top']/p[2]").inner_text.strip
100
- info_hash[:rating] = doc.at_css('.rating-rating').content.gsub(/\/.*/, '').to_f rescue nil
101
+ info_hash[:rating] = doc.at_css('.star-box-giga-star').inner_text.gsub(/[^0-9.]/, '').to_f rescue nil
101
102
 
102
103
  found_info_divs = false
103
104
  movie_properties(doc) do |key, value|
@@ -156,9 +157,9 @@ class YayImdbs
156
157
 
157
158
  # TODO capture all official sites, not all sites have an "Official site" link (e.g. Lost)
158
159
  def get_official_site_url(value, imdb_id)
159
- value = value.match(/<a href="(.*?)">Official site<\/a>/)
160
+ value = value.match(OFFICAL_SITE_REGEX)
160
161
  if value.nil?
161
- value = get_official_sites_page(imdb_id).inner_html.match(/<a href="(.*?)">Official site<\/a>/)
162
+ value = get_official_sites_page(imdb_id).inner_html.match(OFFICAL_SITE_REGEX)
162
163
  end
163
164
  return $1
164
165
  end
@@ -248,7 +249,7 @@ class YayImdbs
248
249
 
249
250
  def video_type_from_meta(doc)
250
251
  type_text = doc.at_css("meta[property='og:type']").try(:[], 'content')
251
- type_text == 'tv_show' ? :tv_show : :movie
252
+ type_text =~ /tv_show/ ? :tv_show : :movie
252
253
  end
253
254
 
254
255
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 6
9
- version: 0.2.6
8
+ - 7
9
+ version: 0.2.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sam Cavenagh
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-08-29 00:00:00 +10:00
17
+ date: 2011-11-14 00:00:00 +11:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency