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 +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/lib/dmm-crawler/attributes.rb +15 -1
- data/lib/dmm-crawler/ranking.rb +6 -2
- data/lib/dmm-crawler/version.rb +1 -1
- data/spec/dmm-crawler/ranking_spec.rb +1 -2
- data/spec/spec_helper.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d81d554887372647840ee289931bb8e48fdf7773
|
|
4
|
+
data.tar.gz: cb08a2dbecf8d0a05d622e263a028d4a30ee8078
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9cc563c97f1391290b6a9d43b57053bc8b661336f49a42b43e6c140f0538b083349e0e8136925348fd13720383fe958a8a40f54c8eefb87a478216bb4caaa6dc
|
|
7
|
+
data.tar.gz: '01795b372af4159cda9661d50dcb76f30fa1ab1cacb34337572d89425abe5d2243e20c9d54e252c4fac8e41f6c12f2a78855f6f4e96fb7d91736511f34ee1313'
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -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 }
|
data/lib/dmm-crawler/ranking.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
data/lib/dmm-crawler/version.rb
CHANGED
|
@@ -20,8 +20,7 @@ describe DMMCrawler::Ranking do
|
|
|
20
20
|
|
|
21
21
|
let(:term) { '24' }
|
|
22
22
|
|
|
23
|
-
it { is_expected.
|
|
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
|
data/spec/spec_helper.rb
CHANGED
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.
|
|
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-
|
|
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.
|
|
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
|