fushin 0.3.4 → 0.4.0

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: 61539140c5b36bd8bd740cae65266f6db2828dad9a7777a1f3413599f481a0c4
4
- data.tar.gz: 97b8814f2d248eb50e4046ac1ea98b74579186de38c250b604ffd751822a8610
3
+ metadata.gz: 4130401cafc166adc3cd2991d961790b4b04dc29a94cc27be3f4b16ec046bceb
4
+ data.tar.gz: c6dd5d23bb2f5b6972f071510a4273cd4a6e24e49c28a72c773c2fac14ab29da
5
5
  SHA512:
6
- metadata.gz: 523e386a0a5f443c6b60c4a346cff2468cb15d966aa6a57abf5c4fdf6a8465189e2159354af45947aff7d80a8204fb4796500a0f33fcfe985c8c86a707612227
7
- data.tar.gz: b77fdaa3e17744419e7192f7a44722ba24f4dfd986eca9873a64440f93aa2b45f84c681dea6f99f63c148e965bdeb18c65b535acffac43ca69e270b534de8bfb
6
+ metadata.gz: 1158d20339e6e1de16d6fecd68c9de1875c478db07655c91664090dccdba12726c24f6fe5796509dd02a0b401aeb7901f7f51ab337f5c80359266637da8d6491
7
+ data.tar.gz: 61250ae22682319f9630b5b3e8f62f37a7856f2d522150e1d2b44a899e0e55fd970bd563dfc00410eb54990f4584dc8f38a8484654fb9fd0501789d4ed831b39
data/README.md CHANGED
@@ -19,6 +19,7 @@ A malicious blog posts monitoring tool.
19
19
 
20
20
  - jugem.jp
21
21
  - kikey.net
22
+ - sblo.jp
22
23
  - seesaa.net
23
24
  - shinobi.jp
24
25
  - teacup.com
@@ -14,6 +14,7 @@ require "fushin/models/website"
14
14
  require "fushin/posts/post"
15
15
  require "fushin/posts/jugem"
16
16
  require "fushin/posts/kikey"
17
+ require "fushin/posts/sblo"
17
18
  require "fushin/posts/seesaa"
18
19
  require "fushin/posts/shinobi"
19
20
  require "fushin/posts/teacup"
@@ -2,4 +2,5 @@
2
2
 
3
3
  module Fushin
4
4
  class NoMachingPostsError < StandardError; end
5
+ class HAResponseError < StandardError; end
5
6
  end
@@ -14,7 +14,12 @@ module Fushin
14
14
  url: url
15
15
  }
16
16
  res = HTTP.headers(default_headers).post(url_for("/quick-scan/url-to-file"), form: payload)
17
- res.code == 200 ? JSON.parse(res.body.to_s) : nil
17
+ if res.code == 200
18
+ JSON.parse(res.body.to_s)
19
+ else
20
+ message = JSON.parse(res.body.to_s).dig("message")
21
+ raise HAResponseError, message
22
+ end
18
23
  end
19
24
 
20
25
  def self.quick_url_scan(url)
@@ -22,6 +22,8 @@ module Fushin
22
22
  out << Posts::Shinobi.new(link)
23
23
  when /teacup\.com/
24
24
  out << Posts::Teacup.new(link)
25
+ when /sblo\.jp/
26
+ out << Posts::Sblo.new(link)
25
27
  else
26
28
  raise NoMachingPostsError
27
29
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fushin
4
+ module Posts
5
+ class Sblo < Post
6
+ def main_selector
7
+ "div.WordSection1"
8
+ end
9
+
10
+ def main_cleanup_selectors
11
+ %w(.posted)
12
+ end
13
+
14
+ def attachements
15
+ @attachements ||= doc.css("div.text > a").map do |a|
16
+ url = a.get("href")
17
+ next unless url
18
+ next unless url.include? "/sblo_files/"
19
+
20
+ Models::Attachment.new url
21
+ end.compact
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fushin
4
- VERSION = "0.3.4"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fushin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-18 00:00:00.000000000 Z
11
+ date: 2019-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -254,6 +254,7 @@ files:
254
254
  - lib/fushin/posts/jugem.rb
255
255
  - lib/fushin/posts/kikey.rb
256
256
  - lib/fushin/posts/post.rb
257
+ - lib/fushin/posts/sblo.rb
257
258
  - lib/fushin/posts/seesaa.rb
258
259
  - lib/fushin/posts/shinobi.rb
259
260
  - lib/fushin/posts/teacup.rb