dmm-crawler 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '06925a3fd6d470aaaf623d6b2da213c5b8ff631f'
4
- data.tar.gz: 40dfc7eb3824eade889b6218d8c2042c4c62ae02
3
+ metadata.gz: d81d554887372647840ee289931bb8e48fdf7773
4
+ data.tar.gz: cb08a2dbecf8d0a05d622e263a028d4a30ee8078
5
5
  SHA512:
6
- metadata.gz: 32e43bd62c3af54c67b60eda38d7455f2209a9d3b2351b7893b94ec9329964c0a38c1ac9975fb3d6b720d2cd5d8be3c0c00a3d927c6021b1c2a9849f64bc3520
7
- data.tar.gz: 42b519cd6268171d10634953c9392b5fdd1b220067dd7ca36c2e8ca1b2496c8d3b147026eb965417c52d7bde2a656caf0d39679d5c3a0fe18b79653f82008767
6
+ metadata.gz: 9cc563c97f1391290b6a9d43b57053bc8b661336f49a42b43e6c140f0538b083349e0e8136925348fd13720383fe958a8a40f54c8eefb87a478216bb4caaa6dc
7
+ data.tar.gz: '01795b372af4159cda9661d50dcb76f30fa1ab1cacb34337572d89425abe5d2243e20c9d54e252c4fac8e41f6c12f2a78855f6f4e96fb7d91736511f34ee1313'
@@ -1,5 +1,8 @@
1
1
  # Change logs
2
2
 
3
+ ## 0.1.3
4
+ - Add crawling more information.
5
+
3
6
  ## 0.1.2
4
7
  - Extract Attributes klass from Ranking klass.
5
8
  - Support art page.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dmm-crawler (0.1.2)
4
+ dmm-crawler (0.1.3)
5
5
  mechanize
6
6
 
7
7
  GEM
@@ -15,6 +15,7 @@ module DMMCrawler
15
15
  description,
16
16
  description_raw,
17
17
  submedia,
18
+ informations,
18
19
  tags
19
20
  ]
20
21
  end
@@ -51,7 +52,7 @@ module DMMCrawler
51
52
  @element.search('.summary .summary__txt').text
52
53
  else
53
54
  @element.search('.rank-desc').text
54
- end
55
+ end.strip
55
56
  end
56
57
 
57
58
  def description_raw
@@ -74,6 +75,19 @@ module DMMCrawler
74
75
  .delete('-')
75
76
  end
76
77
 
78
+ def informations
79
+ keys = extract_text(@element.search('.m-productInformation .productInformation__item .informationList__ttl'))
80
+ values = extract_text(@element.search('.m-productInformation .productInformation__item .informationList__txt'))
81
+
82
+ keys.zip(values).map { |key, value| { key: key, value: value } }
83
+ end
84
+
85
+ def extract_text(elements)
86
+ elements
87
+ .select { |element| element.text.strip != 'ジャンル' }
88
+ .map { |element| element.children.text.strip }
89
+ end
90
+
77
91
  def tags
78
92
  if art_page?
79
93
  @element.search('.genreTagList .genreTagList__item a').map { |e| e.text.strip }
@@ -9,10 +9,13 @@ module DMMCrawler
9
9
 
10
10
  def arts
11
11
  arts = page.search('.rank-rankListItem.fn-setPurchaseChange').map do |element|
12
- Attributes.new(element, @submedia).to_a
12
+ sleep 1
13
+ url = File.join(BASE_URL, element.search('.rank-name a').first.attributes['href'].value)
14
+ page = @agent.get(url)
15
+ Attributes.new(page, @submedia).to_a
13
16
  end
14
17
 
15
- arts.map.with_index(1) do |(title, title_link, image_url, description, description_raw, submedia, tags), rank|
18
+ arts.map.with_index(1) do |(title, title_link, image_url, description, description_raw, submedia, informations, tags), rank|
16
19
  {
17
20
  title: "#{rank}位: #{title}",
18
21
  title_link: title_link,
@@ -20,6 +23,7 @@ module DMMCrawler
20
23
  description: description,
21
24
  description_raw: description_raw,
22
25
  submedia: submedia,
26
+ informations: informations,
23
27
  tags: tags
24
28
  }
25
29
  end
@@ -1,3 +1,3 @@
1
1
  module DMMCrawler
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
@@ -20,8 +20,7 @@ describe DMMCrawler::Ranking do
20
20
 
21
21
  let(:term) { '24' }
22
22
 
23
- it { is_expected.not_to be_empty }
24
- it { is_expected.to all(include(:title, :title_link, :image_url, :description, :description_raw, :submedia, :tags)) }
23
+ it { is_expected.to all(include(:title, :title_link, :image_url, :description, :description_raw, :submedia, :informations, :tags)) }
25
24
  end
26
25
 
27
26
  context 'with not registered argument' do
@@ -1,4 +1,5 @@
1
1
  require 'dmm-crawler'
2
+ require 'pry'
2
3
 
3
4
  RSpec.configure do |config|
4
5
  config.order = 'random'
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.1.2
4
+ version: 0.1.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-06-01 00:00:00.000000000 Z
11
+ date: 2017-06-12 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.12
143
+ rubygems_version: 2.6.10
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Show DMM and DMM.R18's crawled data