imdb_og 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/imdb_og.gemspec +2 -2
  3. data/lib/imdb/imdb.rb +3 -2
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.4
1
+ 0.5.5
data/imdb_og.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{imdb_og}
8
- s.version = "0.5.4"
8
+ s.version = "0.5.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jon Maddox"]
12
- s.date = %q{2010-02-26}
12
+ s.date = %q{2010-03-08}
13
13
  s.description = %q{Simple library to look up movies on IMDB}
14
14
  s.email = %q{jon@mustacheinc.com}
15
15
  s.extra_rdoc_files = [
data/lib/imdb/imdb.rb CHANGED
@@ -8,17 +8,18 @@ class Imdb
8
8
 
9
9
 
10
10
  def self.search_movies_by_title(title)
11
+ coder = HTMLEntities.new
11
12
  document = Hpricot(open("#{IMDB_SEARCH_BASE_URL}#{CGI::escape(title)};s=tt").read)
12
13
  # we got search results
13
14
  if document.search('title').inner_text == "IMDb Title Search"
14
15
  results = document.search('a[@href^="/title/tt"]').reject do |element|
15
16
  element.innerHTML.strip_tags.empty?
16
17
  end.map do |element|
17
- {:imdb_id => element['href'][/tt\d+/], :title => element.innerHTML.strip_tags.unescape_html}
18
+ {:imdb_id => element['href'][/tt\d+/], :title => coder.decode(element.innerHTML.strip_tags.unescape_html)}
18
19
  end
19
20
  results.uniq
20
21
  else
21
- {:imdb_id => document.search('link[@href^="http://www.imdb.com/title/tt"]').first['href'].match(/tt\d+/).to_s, :title => document.search('meta[@name="title"]').first["content"].gsub(/\(\d\d\d\d\)$/, '').strip}
22
+ {:imdb_id => document.search('link[@href^="http://www.imdb.com/title/tt"]').first['href'].match(/tt\d+/).to_s, :title => coder.decode(document.search('meta[@name="title"]').first["content"].gsub(/\(\d\d\d\d\)$/, '').strip)}
22
23
  end
23
24
  end
24
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imdb_og
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Maddox
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-26 00:00:00 -05:00
12
+ date: 2010-03-08 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency