dmm-crawler 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -2
- data/Gemfile.lock +1 -1
- data/lib/dmm-crawler/ranking.rb +13 -1
- data/lib/dmm-crawler/version.rb +1 -1
- data/spec/dmm-crawler/ranking_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb28829797ace3b0102362683982bcdfca075a56
|
4
|
+
data.tar.gz: c4a8628acd41839ed5a51fcf4c258618e6131092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 719401d375387a33ec83b2ba7da3ee6b358c3b7172b455f742c2a09e99d7ed0e675fd907f91198eca45f1bf49ebf0310c8c238c449d99e2eb1a8360b812f6706
|
7
|
+
data.tar.gz: ba6651b43f241a5f3c5d2b8665cc58160f9168e4a17eec011281a21372dda1f269ea442f05cebbe580fc18fd17cc5f908ad125b2d3dfd984678cbfb439191eb8
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
# Change logs
|
2
2
|
|
3
|
-
## 0.0
|
3
|
+
## 0.1.0
|
4
|
+
- Add an attribute raw data of description that include HTML tag.
|
5
|
+
|
6
|
+
## 0.0.7
|
4
7
|
### Critical bug fix
|
5
8
|
- Replace url with image_url
|
9
|
+
- Fix the bug where description is empty.
|
6
10
|
|
7
11
|
## 0.0.6
|
8
|
-
- Fix the bug where description is empty.
|
9
12
|
- Refactor codes related to attributes for the art.
|
10
13
|
|
11
14
|
## 0.0.5
|
data/Gemfile.lock
CHANGED
data/lib/dmm-crawler/ranking.rb
CHANGED
@@ -14,12 +14,13 @@ module DMMCrawler
|
|
14
14
|
Attribute.new(element).to_a
|
15
15
|
end
|
16
16
|
|
17
|
-
arts.map.with_index(1) do |(title, title_link, image_url, description, tags), rank|
|
17
|
+
arts.map.with_index(1) do |(title, title_link, image_url, description, description_raw, tags), rank|
|
18
18
|
{
|
19
19
|
title: "#{rank}位: #{title}",
|
20
20
|
title_link: title_link,
|
21
21
|
image_url: image_url,
|
22
22
|
description: description,
|
23
|
+
description_raw: description_raw,
|
23
24
|
tags: tags
|
24
25
|
}
|
25
26
|
end
|
@@ -37,6 +38,7 @@ module DMMCrawler
|
|
37
38
|
title_link,
|
38
39
|
image_url,
|
39
40
|
description,
|
41
|
+
description_raw,
|
40
42
|
tags
|
41
43
|
]
|
42
44
|
end
|
@@ -59,7 +61,17 @@ module DMMCrawler
|
|
59
61
|
@element.search('.rank-desc').text.nil? ? fetch_description : @element.search('.rank-desc').text
|
60
62
|
end
|
61
63
|
|
64
|
+
def description_raw
|
65
|
+
@element.search('.rank-desc').text.nil? ? fetch_description_raw : @element.search('.rank-desc').to_s
|
66
|
+
end
|
67
|
+
|
62
68
|
def fetch_description
|
69
|
+
url = File.join(BASE_URL, @element.search('.rank-name a').first.attributes['href'].value)
|
70
|
+
page = @agent.get(url)
|
71
|
+
page.search('.summary .summary__txt').text
|
72
|
+
end
|
73
|
+
|
74
|
+
def fetch_description_raw
|
63
75
|
url = File.join(BASE_URL, @element.search('.rank-name a').first.attributes['href'].value)
|
64
76
|
page = @agent.get(url)
|
65
77
|
page.search('.summary .summary__txt').to_s.gsub(/\sclass=".*"/, '')
|
data/lib/dmm-crawler/version.rb
CHANGED
@@ -21,7 +21,7 @@ describe DMMCrawler::Ranking do
|
|
21
21
|
let(:term) { '24' }
|
22
22
|
|
23
23
|
it { is_expected.not_to be_empty }
|
24
|
-
it { is_expected.to all(include(:title, :title_link, :image_url, :description, :tags)) }
|
24
|
+
it { is_expected.to all(include(:title, :title_link, :image_url, :description, :description_raw, :tags)) }
|
25
25
|
end
|
26
26
|
|
27
27
|
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.0
|
4
|
+
version: 0.1.0
|
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-05-
|
11
|
+
date: 2017-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|