web_stat 0.3.5 → 0.3.6

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
  SHA256:
3
- metadata.gz: 3b35413482a93f316bbd3d99a037f0e97102544a4e04604b5add670ac1a1500a
4
- data.tar.gz: 4517b7754b2096901b005c26497fa2addad572b02f08a7aed385f6dc7de2e55a
3
+ metadata.gz: 2ed82b635d751fd0e40eeeef77348ebfc02636f1a9f2d86ca0018c572c4b1f2d
4
+ data.tar.gz: 5034dcc4ba993f6d084228eb3e7e12fe03b92e8ff9e0119d3db8f7ad81521f4a
5
5
  SHA512:
6
- metadata.gz: a54c666953b0c51e1e5ea8d230069bf608e6284629740070f77f3816468553037852c0cbc6c39c35cd53000435fbced4acee6a7b0ca855f2c241e0fb769d32da
7
- data.tar.gz: 3fef9c1c48f272e27c877a4a588ce45f841ad316429bb78fc3aa6de5748d6471b9e5aaed2ee076af0d3fa0779b5696c452c1b0fc2f77644c7914b171377def8e
6
+ metadata.gz: d1a20f17519854baf5cea62ff55236b0ea63f9ab61b3c97df2f276ad7e64694d7d6387824957bee717c50a042734b37dcd26a6761591fa3d6550de8266454ac6
7
+ data.tar.gz: 1669e18b93b126bc3d382eba1e25de554fc23751f0d51635ec42c89fa8c05392d61901bb4fa510e27b1048133e96dba153e213cab3c3de90a2af1461cca88bf2
@@ -47,6 +47,12 @@ module WebStat
47
47
  break
48
48
  end
49
49
  end
50
+ if path.nil?
51
+ path = @nokogiri.at('body').xpath('//img').first.attr('src')
52
+ end
53
+ if path.nil?
54
+ Readability::Document.new(@nokogiri.at('body')).content
55
+ end
50
56
  if ! path.nil? && path.match(/^\//)
51
57
  "#{URI.parse(@url).scheme}://#{URI.parse(@url).host}#{path}"
52
58
  else
@@ -96,7 +102,7 @@ module WebStat
96
102
  # Get the informations of @url
97
103
  # @param [Hash] Specify a dictionary for each language code. example ) {"ja": /***/**.dic, "other": /***/***.dic}
98
104
  def stat(userdics: nil)
99
- clean_content = content.scrub('').gsub(/[\n\t\r ]/, "").gsub(/\s{2,}/, "\s")
105
+ clean_content = content.scrub('').gsub(/[\n\t\r ]/, "").gsub(/\s{2,}/, "\s").gsub(URI.regexp, "")
100
106
  language_code = CLD.detect_language(clean_content)[:code]
101
107
  if userdics && userdics.has_key?(language_code) && File.exists?(userdics[language_code])
102
108
  tag = WebStat::Tag.new("#{title} #{content}", userdic: userdics[language_code])
@@ -1,3 +1,3 @@
1
1
  module WebStat
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_stat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - yusuke abe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-13 00:00:00.000000000 Z
11
+ date: 2020-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler