kinopoisk_parser 1.0.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MTZhMzhiN2M0NTg2ZTA5ODUzOTE5YmU1MzBkZmNmYjM2ZTUxYTU1ZQ==
5
- data.tar.gz: !binary |-
6
- Y2EzNTE4OTljMDM4MWYwMGMxY2YzMjY2Y2MzOTRkYzU3NjZiZGUwZg==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YmY4ZTE3NmI4NzYzNjI4ZWIyZTMyZTM5Nzc0YWNjN2RlMDEyNjFmMTdiYzVi
10
- N2EzY2FlYzcwYzU0ODBhYmE0ZjM4ZjMyOGQ4NGU1MDczY2VhMjc3NmM2ZmM2
11
- MzNhZGJkYmVmMjVlMzM0NjlhOTk3ZmI4OTVlMDc4YzRjMzAxNDI=
12
- data.tar.gz: !binary |-
13
- Y2YwZDk3NjhjMjZkMDRjOGRjYzRmNWIxZGM4OWRhMjc4M2Y2NjY4MWI0Y2Yw
14
- OGRjNGNjY2I2YTMxMmIwZTliMDFlY2I1NzNlMTVlZmNlNmZlMWJiNzM3YTRm
15
- ZDZiNTE5NTQ2ZWM2MGM5NTA4MTNjODllNGNlNTcxODI1MDI0MDQ=
2
+ SHA1:
3
+ metadata.gz: ac098173921e46acef1d4230d92024d5f041fda3
4
+ data.tar.gz: d3d89d4113482e7ef1b343ae553867d586041cfd
5
+ SHA512:
6
+ metadata.gz: e70d34723b3728f55a0bf7d20a2e55cdf81ec8d13521e05135363e595eb4ba5ef539f3505ca0edded750088ff4d0c98996b04aaee52657c3023588cd7fe66ae3
7
+ data.tar.gz: e830b4089498c1f2c32aab158ca41259ade4ecab0fa8baabdc03a40cdf1d656ff054ea79ea9d3334b20079edab0d0b2ee6dc6023fd2e3ff9d4f5294eaaff49ec
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'kinopoisk_parser'
3
- gem.version = '1.0.6'
3
+ gem.version = '2.0.0'
4
4
  gem.authors = ['RavWar']
5
5
  gem.email = ['rav_war@mail.ru']
6
6
  gem.homepage = 'https://github.com/RavWar/kinopoisk_parser'
@@ -21,7 +21,7 @@ module Kinopoisk
21
21
 
22
22
  # Returns an array of strings containing actor names
23
23
  def actors
24
- doc.search('td.actor_list div a').map{|n| n.text.gsub("\n",'').strip}
24
+ doc.search('#actorList ul li a').map{|n| n.text.gsub("\n",'').strip}
25
25
  .delete_if{|text| text=='...'}
26
26
  end
27
27
 
@@ -72,7 +72,7 @@ module Kinopoisk
72
72
 
73
73
  # Returns a url to a small sized poster
74
74
  def poster
75
- doc.search("img[itemprop='image']").first.attr 'src'
75
+ doc.search(".film-img-box img[itemprop='image']").first.attr 'src'
76
76
  end
77
77
 
78
78
  # Returns a string containing world premiere date
@@ -92,7 +92,7 @@ module Kinopoisk
92
92
 
93
93
  # Returns a url to a big sized poster
94
94
  def poster_big
95
- poster.gsub 'film', 'film_big'
95
+ poster.gsub 'iphone/iphone360_', 'big/'
96
96
  end
97
97
 
98
98
  # Returns an integer length of the movie in minutes
@@ -160,6 +160,16 @@ module Kinopoisk
160
160
  search_by_text 'слоган'
161
161
  end
162
162
 
163
+ # Returns a string containing minimal age
164
+ def minimal_age
165
+ search_by_text('возраст').strip
166
+ end
167
+
168
+ # Returns a string containing duration of the film
169
+ def duration
170
+ search_by_text('время').strip
171
+ end
172
+
163
173
  private
164
174
 
165
175
  def doc
@@ -18,7 +18,7 @@ module Kinopoisk
18
18
 
19
19
  # Returns a url to a poster
20
20
  def poster
21
- doc.search('img.people_thumbnail').first.attr 'src'
21
+ doc.search(".film-img-box img").first.attr 'src'
22
22
  end
23
23
 
24
24
  # Returns a string containing name in russian
@@ -28,7 +28,7 @@ module Kinopoisk
28
28
 
29
29
  # Returns a string containing name in english
30
30
  def name_en
31
- doc.search("//tr[./td/h1[@class='moviename-big']]/following-sibling::tr//span").text
31
+ doc.search("#headerPeople span[itemprop='alternativeHeadline']").text.strip
32
32
  end
33
33
 
34
34
  # Returns a string containing partner's name
@@ -63,17 +63,17 @@ module Kinopoisk
63
63
 
64
64
  # Returns an array of strings containing best movie titles
65
65
  def best_movies
66
- doc.search('td.actor_list a').map(&:text)
66
+ doc.search('#BestFilmList a').map(&:text)
67
67
  end
68
68
 
69
69
  # Returns a string containing year of first movie
70
70
  def first_movie
71
- search_by_text 'первый фильм'
71
+ doc.search("a[title='Первый фильм']").text
72
72
  end
73
73
 
74
74
  # Returns a string containing year of last movie
75
75
  def last_movie
76
- search_by_text 'последний фильм'
76
+ doc.search("a[title='Последний фильм']").text
77
77
  end
78
78
 
79
79
  # Returns a string containing height
@@ -15,7 +15,7 @@ module Kinopoisk
15
15
 
16
16
  # Returns an array containing Kinopoisk::Person instances
17
17
  def people
18
- find_nodes('people').map{|n| new_person n }
18
+ find_nodes('name').map{|n| new_person n }
19
19
  end
20
20
 
21
21
  private
@@ -37,7 +37,7 @@ module Kinopoisk
37
37
  end
38
38
 
39
39
  def new_person(node)
40
- Person.new parse_id(node, 'people'), node.text
40
+ Person.new parse_id(node, 'name'), node.text
41
41
  end
42
42
  end
43
43
  end
@@ -8,33 +8,36 @@ describe Kinopoisk::Movie, vcr: { cassette_name: 'movies' } do
8
8
  it { dexter.url.should eq('http://www.kinopoisk.ru/film/277537/') }
9
9
  it { dexter.title.should eq('Правосудие Декстера') }
10
10
  it { dexter.title_en.should eq('Dexter') }
11
- it { dexter.countries.should eq(['США']) }
11
+
12
+ it { dexter.poster.should eq('http://st.kp.yandex.net/images/film_iphone/iphone360_277537.jpg') }
13
+ it { dexter.poster_big.should eq('http://st.kp.yandex.net/images/film_big/277537.jpg') }
14
+
12
15
  it { dexter.year.should eq(2006) }
13
- it { dexter.poster.should eq('http://st.kinopoisk.ru/images/film/277537.jpg') }
14
- it { dexter.poster_big.should eq('http://st.kinopoisk.ru/images/film_big/277537.jpg') }
16
+ it { dexter.countries.should eq(['США']) }
17
+ it { dexter.slogan.should eq('«Takes life. Seriously»') }
18
+ it { dexter.directors.should eq(['Джон Дал','Стив Шилл','Кит Гордон']) }
19
+ it { dexter.writers.should eq(['Скотт Бак', 'Карен Кэмпбелл', 'Дэниэл Церон']) }
15
20
  it { dexter.producers.should eq(['Сара Коллетон','Джон Голдвин','Роберт Ллойд Льюис']) }
16
- it { dexter.art_directors.should eq(['Джессика Кендер','Энтони Коули','Эрик Уейлер']) }
17
21
  it { dexter.operators.should eq(['Ромео Тироне','Джеф Джёр','Мартин Дж. Лэйтон']) }
18
- it { dexter.editors.should eq(['Луис Ф. Циоффи','Стюарт Шилл','Мэттью Колонна']) }
19
- it { dexter.writers.should eq(['Джефф Линдсэй','Джеймс Манос мл.','Скотт Бак']) }
20
- it { dexter.actors.should include('Майкл С. Холл', 'Дженнифер Карпентер') }
22
+ it { dexter.composers.should eq(['Дэниэл Лихт']) }
23
+ it { dexter.art_directors.should eq(['Джессика Кендер','Энтони Коули','Эрик Уейлер']) }
24
+ it { dexter.editors.should eq(['Луис Ф. Циоффи','Стюарт Шилл','Кит Хендерсон']) }
21
25
  it { dexter.genres.should eq(['триллер','драма','криминал', 'детектив']) }
22
- it { dexter.directors.should eq(['Джон Дал','Стив Шилл','Кит Гордон']) }
23
- it { dexter.slogan.should eq('«Takes life. Seriously.»') }
26
+ it { dexter.actors.should include('Майкл С. Холл', 'Дженнифер Карпентер') }
24
27
  it { dexter.description.should match('Декстер Морган.') }
25
28
  it { dexter.premiere_world.should eq('1 октября 2006') }
26
29
  it { dexter.premiere_ru.should eq('3 ноября 2008') }
27
- it { dexter.composers.should eq(['Дэниэл Лихт']) }
30
+ it { dexter.minimal_age.should eq('зрителям, достигшим 18 лет') }
31
+ it { dexter.duration.should eq ('55 мин.') }
28
32
  it { dexter.imdb_rating_count.should be_a(Integer) }
29
33
  it { dexter.imdb_rating.should be_a(Float) }
30
34
  it { dexter.rating_count.should be_a(Integer) }
31
35
  it { dexter.rating.should be_a(Float) }
32
36
  it { dexter.box_office_ru.should eq('') }
33
-
34
37
  it { avatar.box_office_world.should match('[$\d]') }
35
38
  it { avatar.box_office_ru.should match('[$\d]') }
36
39
  it { avatar.box_office_us.should match('[$\d]') }
37
- it { avatar.budget.should eq("$237 000 000") }
40
+ it { avatar.budget.should eq('$237 000 000') }
38
41
  it { avatar.length.should eq(162) }
39
42
 
40
43
  it 'should make only one request' do
@@ -9,7 +9,7 @@ describe Kinopoisk::Person, vcr: { cassette_name: 'people' } do
9
9
  end
10
10
 
11
11
  it { person.best_movies.should include('Карты, деньги, два ствола', 'Братья по оружию') }
12
- it { person.poster.should eq('http://st.kinopoisk.ru/images/actor/13180.jpg') }
12
+ it { person.poster.should eq('http://st.kp.yandex.net/images/actor_iphone/iphone360_13180.jpg') }
13
13
  it { person.career.should eq(['Актер', 'Режиссер', 'Сценарист', 'Продюсер']) }
14
14
  it { person.genres.should eq(['драма', 'комедия', 'криминал']) }
15
15
  it { person.partner.should eq('Далия Ибельхауптайте') }
@@ -19,6 +19,6 @@ describe Kinopoisk::Person, vcr: { cassette_name: 'people' } do
19
19
  it { person.first_movie.should eq('1976') }
20
20
  it { person.last_movie.should eq('2014') }
21
21
  it { person.birthdate.should be_a(Date) }
22
- it { person.total_movies.should eq(87) }
22
+ it { person.total_movies.should eq(93) }
23
23
  it { person.height.should eq('1.68 м') }
24
24
  end
metadata CHANGED
@@ -1,101 +1,102 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kinopoisk_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RavWar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-05 00:00:00.000000000 Z
11
+ date: 2014-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httpclient
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: vcr
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description: ! " This gem allows you to easily search and access publicly available\n
98
- \ information about movies and actors on kinopoisk.ru\n"
97
+ description: |2
98
+ This gem allows you to easily search and access publicly available
99
+ information about movies and actors on kinopoisk.ru
99
100
  email:
100
101
  - rav_war@mail.ru
101
102
  executables: []
@@ -126,17 +127,17 @@ require_paths:
126
127
  - lib
127
128
  required_ruby_version: !ruby/object:Gem::Requirement
128
129
  requirements:
129
- - - ! '>='
130
+ - - '>='
130
131
  - !ruby/object:Gem::Version
131
132
  version: '0'
132
133
  required_rubygems_version: !ruby/object:Gem::Requirement
133
134
  requirements:
134
- - - ! '>='
135
+ - - '>='
135
136
  - !ruby/object:Gem::Version
136
137
  version: '0'
137
138
  requirements: []
138
139
  rubyforge_project:
139
- rubygems_version: 2.0.3
140
+ rubygems_version: 2.2.2
140
141
  signing_key:
141
142
  specification_version: 4
142
143
  summary: Easily search and access information on kinopoisk.ru
@@ -145,3 +146,4 @@ test_files:
145
146
  - spec/kinopoisk/person_spec.rb
146
147
  - spec/kinopoisk/search_spec.rb
147
148
  - spec/spec_helper.rb
149
+ has_rdoc: