unified_db 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/extensions/imdb.rb +24 -0
- data/lib/unified_db/version.rb +1 -1
- data/lib/unified_db.rb +6 -3
- data/unified_db.gemspec +1 -1
- metadata +15 -14
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'imdb'
|
2
|
+
|
3
|
+
module Imdb
|
4
|
+
class Search < MovieList
|
5
|
+
|
6
|
+
def self.query(query)
|
7
|
+
open("http://anonymouse.org/cgi-bin/anon-www.cgi/http://akas.imdb.com/find?q=#{CGI::escape(query)};s=tt")
|
8
|
+
end
|
9
|
+
|
10
|
+
def parse_movie
|
11
|
+
id = document.at("head/link[@rel='canonical']")['href'][/\d+/]
|
12
|
+
title = document.at("h1").innerHTML.imdb_strip_tags.gsub("\n", " ").strip.imdb_unescape_html
|
13
|
+
[Imdb::Movie.new(id, title)]
|
14
|
+
end
|
15
|
+
|
16
|
+
def parse_movies
|
17
|
+
document.search("a[@href^='http://anonymouse.org/cgi-bin/anon-www.cgi/http://akas.imdb.com/title/tt']").each do |pm|
|
18
|
+
pm["href"] = pm["href"].gsub("http://anonymouse.org/cgi-bin/anon-www.cgi/http://akas.imdb.com", "")
|
19
|
+
end
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
data/lib/unified_db/version.rb
CHANGED
data/lib/unified_db.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
module UnifiedDB
|
2
|
-
|
2
|
+
|
3
3
|
ROOT = File.expand_path(File.dirname(__FILE__))
|
4
4
|
|
5
|
+
require "#{ROOT}/extensions/imdb"
|
6
|
+
|
5
7
|
autoload :ApiError, "#{ROOT}/unified_db/api_error"
|
6
8
|
autoload :Backend, "#{ROOT}/unified_db/backend"
|
7
9
|
autoload :Result, "#{ROOT}/unified_db/result"
|
8
10
|
autoload :Version, "#{ROOT}/unified_db/version"
|
9
|
-
|
11
|
+
|
12
|
+
|
10
13
|
class << self
|
11
14
|
attr_accessor :json_encoder, :tvdb_secret
|
12
|
-
|
15
|
+
|
13
16
|
def json_encoder
|
14
17
|
@json_encoder ||= Yajl::Encoder.new
|
15
18
|
end
|
data/unified_db.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = %q{Scrapper for multiple Movie Databases}
|
14
14
|
|
15
15
|
s.add_dependency 'yajl-ruby'
|
16
|
-
s.add_dependency 'imdb', '
|
16
|
+
s.add_dependency 'imdb', '0.6.8'
|
17
17
|
s.add_dependency 'httparty', '0.8.1'
|
18
18
|
s.add_dependency 'imdb_party', '0.6.1'
|
19
19
|
s.add_dependency 'tvdb_party', '0.6.2'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unified_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-06-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yajl-ruby
|
16
|
-
requirement: &
|
16
|
+
requirement: &70192558632580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,21 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70192558632580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: imdb
|
27
|
-
requirement: &
|
27
|
+
requirement: &70192558631680 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - =
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.6.8
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70192558631680
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: httparty
|
38
|
-
requirement: &
|
38
|
+
requirement: &70192558630780 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - =
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.8.1
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70192558630780
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: imdb_party
|
49
|
-
requirement: &
|
49
|
+
requirement: &70192558629840 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - =
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.6.1
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70192558629840
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: tvdb_party
|
60
|
-
requirement: &
|
60
|
+
requirement: &70192558629020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - =
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.6.2
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70192558629020
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &70192558628220 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '2.0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70192558628220
|
80
80
|
description: Scrapper for multiple Movie Databases
|
81
81
|
email:
|
82
82
|
- bernard.potocki@imanel.org
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- Gemfile
|
90
90
|
- README.md
|
91
91
|
- Rakefile
|
92
|
+
- lib/extensions/imdb.rb
|
92
93
|
- lib/unified_db.rb
|
93
94
|
- lib/unified_db/api_error.rb
|
94
95
|
- lib/unified_db/backend.rb
|