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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb56239edb86563849592406e4f1200bb4d65ed4
4
- data.tar.gz: 3b1da0a4739d6c58c3150a34cfafca8a28007feb
3
+ metadata.gz: fb28829797ace3b0102362683982bcdfca075a56
4
+ data.tar.gz: c4a8628acd41839ed5a51fcf4c258618e6131092
5
5
  SHA512:
6
- metadata.gz: cc7ba070fddeb892b273c9ebc462e7fdbd887eaf9ee502d3b27733fa42a82ac5db487bdbc3ccc3ee9173d4a674038b9029aadb2d019deebc0f9b46e766114080
7
- data.tar.gz: dec069dd897e02a5e9e15d51184b2237c11889d66b8f0d435fe609d1a599b68998d29c373af730d3c848359c91a26627bbe6543d3b5758bc6d20dc522b0612ec
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.6
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dmm-crawler (0.0.7)
4
+ dmm-crawler (0.1.0)
5
5
  mechanize
6
6
 
7
7
  GEM
@@ -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=".*"/, '')
@@ -1,3 +1,3 @@
1
1
  module DMMCrawler
2
- VERSION = '0.0.7'.freeze
2
+ VERSION = '0.1.0'.freeze
3
3
  end
@@ -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.7
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-22 00:00:00.000000000 Z
11
+ date: 2017-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize