dmm-crawler 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0fbdb558032e848d11224c9030642f04dfee44bf
4
- data.tar.gz: ccb2cc27b9aafe47ca5331ae092889345fd177f9
3
+ metadata.gz: 653778e42cde0643d26e9e7e24c4f7b7aefff105
4
+ data.tar.gz: 715a8a7937cb7b4351f11718fcf0327ef85700c0
5
5
  SHA512:
6
- metadata.gz: 72f5cd5902904c4fe4100fbacf5374bc28070406112d5ca82a5abd909a5eb3c5d7882b77ca905ce60254c9a8b0daf56d74a7df7fc7c7ae77d54c631cad0e50d0
7
- data.tar.gz: 70f8c48093ab24a88c1923312db6c6e2131c2704c04f1d6d20ac603d90b7efa9df1b237313cdfb6be1357064aec89a1c15c4fe831112ae78ea8b4ef8a39be200
6
+ metadata.gz: cadd766510e0de7319ec516a708ec6d9b3ce315f79d6fa5c52ac1ca3f0b31c65acd276230932c051b0ccdb99cfb689e915bb0f02c76ea06c67d3b172705fb1f8
7
+ data.tar.gz: d9b31e5c90c5141c0ca7a26d6a64d48343fa920ee3ebd475aece738d769536a0cccaa478d864c36814eeaf4907f7e654396f6e1feafd24940d4867b03fef30b8
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  /vendor
2
2
  /pkg
3
+ Gemfile.lock
@@ -1,5 +1,18 @@
1
1
  # Change logs
2
2
 
3
+ ## 0.2.3
4
+ - Do not lock gem versions in 'dmm-crawler.gemspec'.
5
+ - Change the author name element due to it is not found.
6
+
7
+ ### Security Changes
8
+ - Lock the RuboCop version over `0.49.0`.
9
+
10
+ ### Breaking Changes
11
+ - Reduce the ranking size to ten.
12
+
13
+ ## 0.2.2
14
+ - Do not manage 'Gemfile.lock'.
15
+
3
16
  ## 0.2.1
4
17
  - Add an attribute for author.
5
18
 
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_runtime_dependency 'mechanize'
21
21
 
22
- spec.add_development_dependency 'bundler', '~> 1.14'
23
- spec.add_development_dependency 'rake', '~> 10.0'
24
- spec.add_development_dependency 'rubocop', '~> 0.47'
25
- spec.add_development_dependency 'pry', '0.10.4'
26
- spec.add_development_dependency 'rspec', '3.5.0'
22
+ spec.add_development_dependency 'bundler'
23
+ spec.add_development_dependency 'rake'
24
+ spec.add_development_dependency 'rubocop', '< 0.49.0'
25
+ spec.add_development_dependency 'pry'
26
+ spec.add_development_dependency 'rspec'
27
27
  end
@@ -60,7 +60,7 @@ module DMMCrawler
60
60
  end
61
61
 
62
62
  def author
63
- @page.search('p.circleProductTitle__main').text.gsub('作品一覧', '')
63
+ @page.search('div.circleName__item').text.strip
64
64
  end
65
65
 
66
66
  def informations
@@ -8,10 +8,11 @@ module DMMCrawler
8
8
  end
9
9
 
10
10
  def arts
11
- arts = page.search('.rank-rankListItem.fn-setPurchaseChange').map do |element|
12
- sleep 1
13
- url = File.join(BASE_URL, element.search('.rank-name a').first.attributes['href'].value)
14
- Attributes.new(url).to_a
11
+ arts = page.search('.rank-rankListItem.fn-setPurchaseChange').take(10).map do |element|
12
+ sleep_each do
13
+ url = File.join(BASE_URL, element.search('.rank-name a').first.attributes['href'].value)
14
+ Attributes.new(url).to_a
15
+ end
15
16
  end
16
17
 
17
18
  arts.map.with_index(1) do |(title, title_link, image_url, submedia, author, informations, tags), rank|
@@ -42,5 +43,10 @@ module DMMCrawler
42
43
  return agent if agent.is_a?(Mechanize)
43
44
  raise TypeError
44
45
  end
46
+
47
+ def sleep_each
48
+ sleep rand(0.7..1.3)
49
+ yield
50
+ end
45
51
  end
46
52
  end
@@ -1,3 +1,3 @@
1
1
  module DMMCrawler
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.3'.freeze
3
3
  end
@@ -13,7 +13,7 @@ describe DMMCrawler::Ranking do
13
13
 
14
14
  let(:term) { '24' }
15
15
 
16
- it { is_expected.to be 20 }
16
+ it { is_expected.to be 10 }
17
17
  end
18
18
 
19
19
  context 'with 24 argument' do
@@ -22,6 +22,7 @@ describe DMMCrawler::Ranking do
22
22
  let(:term) { '24' }
23
23
 
24
24
  it { is_expected.to all(include(:title, :title_link, :image_url, :submedia, :author, :informations, :tags)) }
25
+ it { is_expected.to all(satisfy { |art| art.all? { |_k, v| v != '' } }) }
25
26
  end
26
27
 
27
28
  context 'with not registered argument' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dmm-crawler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Ohmori
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-30 00:00:00.000000000 Z
11
+ date: 2017-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -28,72 +28,72 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.14'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.14'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
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
- version: '10.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - "<"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.47'
61
+ version: 0.49.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
- version: '0.47'
68
+ version: 0.49.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.10.4
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
- version: 0.10.4
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 3.5.0
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
- version: 3.5.0
96
+ version: '0'
97
97
  description: Show DMM and DMM.R18's crawled data. e.g. ranking
98
98
  email:
99
99
  - sachin21dev@gmail.com
@@ -107,7 +107,6 @@ files:
107
107
  - ".travis.yml"
108
108
  - CHANGELOG.md
109
109
  - Gemfile
110
- - Gemfile.lock
111
110
  - LICENSE.txt
112
111
  - README.md
113
112
  - Rakefile
@@ -141,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
140
  version: '0'
142
141
  requirements: []
143
142
  rubyforge_project:
144
- rubygems_version: 2.5.2
143
+ rubygems_version: 2.6.11
145
144
  signing_key:
146
145
  specification_version: 4
147
146
  summary: Show DMM and DMM.R18's crawled data
@@ -1,84 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- dmm-crawler (0.2.1)
5
- mechanize
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- ast (2.3.0)
11
- coderay (1.1.1)
12
- diff-lcs (1.3)
13
- domain_name (0.5.20170404)
14
- unf (>= 0.0.5, < 1.0.0)
15
- http-cookie (1.0.3)
16
- domain_name (~> 0.5)
17
- mechanize (2.7.5)
18
- domain_name (~> 0.5, >= 0.5.1)
19
- http-cookie (~> 1.0)
20
- mime-types (>= 1.17.2)
21
- net-http-digest_auth (~> 1.1, >= 1.1.1)
22
- net-http-persistent (~> 2.5, >= 2.5.2)
23
- nokogiri (~> 1.6)
24
- ntlm-http (~> 0.1, >= 0.1.1)
25
- webrobots (>= 0.0.9, < 0.2)
26
- method_source (0.8.2)
27
- mime-types (3.1)
28
- mime-types-data (~> 3.2015)
29
- mime-types-data (3.2016.0521)
30
- mini_portile2 (2.3.0)
31
- net-http-digest_auth (1.4.1)
32
- net-http-persistent (2.9.4)
33
- nokogiri (1.8.1)
34
- mini_portile2 (~> 2.3.0)
35
- ntlm-http (0.1.1)
36
- parser (2.4.0.0)
37
- ast (~> 2.2)
38
- powerpack (0.1.1)
39
- pry (0.10.4)
40
- coderay (~> 1.1.0)
41
- method_source (~> 0.8.1)
42
- slop (~> 3.4)
43
- rainbow (2.2.1)
44
- rake (10.5.0)
45
- rspec (3.5.0)
46
- rspec-core (~> 3.5.0)
47
- rspec-expectations (~> 3.5.0)
48
- rspec-mocks (~> 3.5.0)
49
- rspec-core (3.5.4)
50
- rspec-support (~> 3.5.0)
51
- rspec-expectations (3.5.0)
52
- diff-lcs (>= 1.2.0, < 2.0)
53
- rspec-support (~> 3.5.0)
54
- rspec-mocks (3.5.0)
55
- diff-lcs (>= 1.2.0, < 2.0)
56
- rspec-support (~> 3.5.0)
57
- rspec-support (3.5.0)
58
- rubocop (0.47.1)
59
- parser (>= 2.3.3.1, < 3.0)
60
- powerpack (~> 0.1)
61
- rainbow (>= 1.99.1, < 3.0)
62
- ruby-progressbar (~> 1.7)
63
- unicode-display_width (~> 1.0, >= 1.0.1)
64
- ruby-progressbar (1.8.1)
65
- slop (3.6.0)
66
- unf (0.1.4)
67
- unf_ext
68
- unf_ext (0.0.7.4)
69
- unicode-display_width (1.1.3)
70
- webrobots (0.1.2)
71
-
72
- PLATFORMS
73
- ruby
74
-
75
- DEPENDENCIES
76
- bundler (~> 1.14)
77
- dmm-crawler!
78
- pry (= 0.10.4)
79
- rake (~> 10.0)
80
- rspec (= 3.5.0)
81
- rubocop (~> 0.47)
82
-
83
- BUNDLED WITH
84
- 1.16.0.pre.2