dmm-crawler 0.2.5 → 0.2.6

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
- SHA1:
3
- metadata.gz: 5c13b5c6a23e29bdbfeb8e0c8369be6af3a7f775
4
- data.tar.gz: c6bf3c7c8405c021deff1e01f8645290195cfbdf
2
+ SHA256:
3
+ metadata.gz: a63c5c9dd8d6e46df1f00d53eaa4f0cd95b2bffcd2406f155bd582eb864d9cb8
4
+ data.tar.gz: 16d93c3d3806d8a87abff9e53ec2c89403a8b2fd492d513aa8da947195d5e2da
5
5
  SHA512:
6
- metadata.gz: d3a3d45d82380965ec675ed5435a278c30c757f08e2f7e2e74b09afd49eb2d84894186ace17cfdfe80c2716288042a8fc9c9d4f3e772327ea4020ecda33f677e
7
- data.tar.gz: 2473fb64835f1cbbe7d5be88a744e66b22f89af8bc444d4543b13871a915942aab70cc7d1a9a2ea1c4ceca92a68ce9d9128792587df14f61613c838aab86df96
6
+ metadata.gz: 3232d0428c2d8a2211412c850a2d1a0f6b03dcd5ffd0097ba0ed366cb8b875b734ddc0c3c6966ee21d3efc334e163506869a443417e1dbba8701715bd3b97a0f
7
+ data.tar.gz: 749b25cc7e6bc4038f873de594f8ffe0fc8fb292c177fa717eb64c2a1907ec68104f08c2a5e023f12ba18445f564c7557c21a8580d8edc62d5004736cfa76c89
data/.travis.yml CHANGED
@@ -12,4 +12,5 @@ before_install:
12
12
  script: 'bundle exec rake spec'
13
13
 
14
14
  notifications:
15
+ email: false
15
16
  slack: sachin21dev:J8sIAeYdBknOGbFHtrphiobX
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change logs
2
2
 
3
+ ## 0.2.6
4
+ - Fetch the price of the art.
5
+
3
6
  ## 0.2.5
4
7
  - Make agent selectable in Attributes class.
5
8
 
data/README.md CHANGED
@@ -34,7 +34,10 @@ client.rankings(term: '24', submedia: 'cg')
34
34
  # title_link: "title url",
35
35
  # image_url: "Link to title"s main image",
36
36
  # submedia: "cg",
37
+ # author: "author",
37
38
  # informations: [{key: 'key', value: 'value'}],
39
+ # rank: '1'
40
+ # price: '1000'
38
41
  # tags: ["tag1", "tag2"]
39
42
  # }
40
43
  ```
@@ -12,6 +12,7 @@ module DMMCrawler
12
12
  submedia,
13
13
  author,
14
14
  informations,
15
+ price,
15
16
  tags
16
17
  ]
17
18
  end
@@ -59,6 +60,12 @@ module DMMCrawler
59
60
  .delete('-')
60
61
  end
61
62
 
63
+ def price
64
+ @page
65
+ .search('.m-priceList .priceList__sub.priceList__sub--big')
66
+ .text.strip.delete('円,')
67
+ end
68
+
62
69
  def author
63
70
  @page.search('div.circleName__item').text.strip
64
71
  end
@@ -71,7 +78,7 @@ module DMMCrawler
71
78
  series = information.find { |array| array.first == 'シリーズ' }
72
79
 
73
80
  if series
74
- information = information.select { |array| array.first != 'シリーズ' }
81
+ information = information.reject { |array| array.first == 'シリーズ' }
75
82
  information.push(series)
76
83
  end
77
84
 
@@ -88,7 +95,7 @@ module DMMCrawler
88
95
 
89
96
  def extract_text(elements)
90
97
  elements
91
- .select { |element| element.text.strip != 'ジャンル' }
98
+ .reject { |element| element.text.strip == 'ジャンル' }
92
99
  .map { |element| element.children.text.strip }
93
100
  end
94
101
 
@@ -15,7 +15,7 @@ module DMMCrawler
15
15
  end
16
16
  end
17
17
 
18
- arts.map.with_index(1) do |(title, title_link, image_url, submedia, author, informations, tags), rank|
18
+ arts.map.with_index(1) do |(title, title_link, image_url, submedia, author, informations, price, tags), rank|
19
19
  {
20
20
  title: title,
21
21
  title_link: title_link,
@@ -24,6 +24,7 @@ module DMMCrawler
24
24
  author: author,
25
25
  informations: informations,
26
26
  rank: rank,
27
+ price: price,
27
28
  tags: tags
28
29
  }
29
30
  end
@@ -36,7 +37,7 @@ module DMMCrawler
36
37
  end
37
38
 
38
39
  def discriminate_term(term)
39
- return term if %w(24 weekly monthly total).include?(term)
40
+ return term if %w[24 weekly monthly total].include?(term)
40
41
  raise TypeError
41
42
  end
42
43
 
@@ -1,3 +1,3 @@
1
1
  module DMMCrawler
2
- VERSION = '0.2.5'.freeze
2
+ VERSION = '0.2.6'.freeze
3
3
  end
@@ -21,7 +21,7 @@ describe DMMCrawler::Ranking do
21
21
 
22
22
  let(:term) { '24' }
23
23
 
24
- it { is_expected.to all(include(:title, :title_link, :image_url, :submedia, :author, :informations, :rank, :tags)) }
24
+ it { is_expected.to all(include(:title, :title_link, :image_url, :submedia, :author, :informations, :rank, :price, :tags)) }
25
25
  it { is_expected.to all(satisfy { |art| art.all? { |_k, v| v != '' } }) }
26
26
  end
27
27
 
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.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Ohmori
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-31 00:00:00.000000000 Z
11
+ date: 2018-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  requirements: []
142
142
  rubyforge_project:
143
- rubygems_version: 2.6.14
143
+ rubygems_version: 2.7.6
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Show DMM and DMM.R18's crawled data