Ruby4Misawa 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/README.rdoc +1 -3
- data/{Ruby4Misawa-0.1.1.gemspec → Ruby4Misawa-0.1.2.gemspec} +2 -2
- data/lib/Ruby4Misawa.rb +24 -96
- metadata +59 -30
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -11,6 +11,7 @@ gem install Ruby4Misawa でおk
|
|
11
11
|
|
12
12
|
== つかいかた
|
13
13
|
|
14
|
+
libにあるRuby4Misawa.rbを適当に移動して、
|
14
15
|
ruby Ruby4Misawa.rb [オプション] [値]
|
15
16
|
|
16
17
|
[-t [uri, save]] uriは画像のURIを出力、saveは保存しまくる。permission関係でこける可能性はありけり。
|
@@ -21,6 +22,3 @@ ruby Ruby4Misawa.rb [オプション] [値]
|
|
21
22
|
|
22
23
|
ちなみに何も指定しないと地獄のミサワのトップページにあるミサワ画像(と思われるもの)を取ってくる
|
23
24
|
|
24
|
-
== 備考
|
25
|
-
|
26
|
-
なんかおかしかったらすいません
|
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do | spec |
|
4
4
|
spec.name = 'Ruby4Misawa'
|
5
|
-
spec.version = '0.1.
|
5
|
+
spec.version = '0.1.2'
|
6
6
|
spec.summary = 'スクレイピングライブラリ for 地獄のミサワ'
|
7
7
|
spec.description = '地獄のミサワブログにあるURLがとれたり、そのまま画像を保存したりできます。'
|
8
8
|
spec.homepage = 'https://github.com/namusyaka/Ruby4Misawa'
|
9
9
|
spec.author = 'namusyaka'
|
10
10
|
spec.email = 'namusyaka@gmail.com'
|
11
|
-
spec.files = %w( README.rdoc Ruby4Misawa-0.1.
|
11
|
+
spec.files = %w( README.rdoc Ruby4Misawa-0.1.2.gemspec Gemfile lib lib/Ruby4Misawa.rb )
|
12
12
|
spec.add_development_dependency('nokogiri')
|
13
13
|
end
|
data/lib/Ruby4Misawa.rb
CHANGED
@@ -1,104 +1,36 @@
|
|
1
1
|
# -*- encoding: UTF-8 -*-
|
2
2
|
|
3
|
-
%w(
|
4
|
-
|
5
|
-
|
3
|
+
%w(
|
4
|
+
uri
|
5
|
+
open-uri
|
6
|
+
kconv
|
7
|
+
optparse
|
8
|
+
rubygems
|
9
|
+
nokogiri
|
10
|
+
).each { | name | require name }
|
6
11
|
|
7
12
|
class Misawa
|
8
13
|
|
14
|
+
class NotFoundError < ArgumentError; end;
|
15
|
+
|
9
16
|
DOMAIN = 'http://jigokuno.com/'
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
"あの御方" => 37,
|
22
|
-
"しょうへい" => 66,
|
23
|
-
"すなお" => 38,
|
24
|
-
"たばっち" => 52,
|
25
|
-
"ちんちんでか男" => 57,
|
26
|
-
"つっちー" => 7,
|
27
|
-
"てづっちゃん" => 67,
|
28
|
-
"とりっぴー" => 82,
|
29
|
-
"なかじ" => 28,
|
30
|
-
"のぶちゃん" => 22,
|
31
|
-
"のぼる" => 49,
|
32
|
-
"のりすけ" => 21,
|
33
|
-
"はしもっさん" => 44,
|
34
|
-
"はまちゃん" => 55,
|
35
|
-
"ぴーなっつ" => 58,
|
36
|
-
"まみのパパ" => 56,
|
37
|
-
"りきお" => 85,
|
38
|
-
"エ~イチ" => 83,
|
39
|
-
"キヨシロー" => 17,
|
40
|
-
"キング" => 84,
|
41
|
-
"コウヘイ" => 3,
|
42
|
-
"シュナイダー" => 34,
|
43
|
-
"ショップ店員" => 12,
|
44
|
-
"ジーンズ" => 36,
|
45
|
-
"ジェイ" => 10,
|
46
|
-
"ソドム" => 78,
|
47
|
-
"タケ" => 54,
|
48
|
-
"チーポー" => 35,
|
49
|
-
"デスピサロ" => 46,
|
50
|
-
"ドリモグ" => 40,
|
51
|
-
"ナイト" => 50,
|
52
|
-
"ハリソン・フォード" => 41,
|
53
|
-
"バイトリーダー" => 71,
|
54
|
-
"ファイナルボム" => 74,
|
55
|
-
"フェイク" => 32,
|
56
|
-
"マイク" => 65,
|
57
|
-
"ミラージュ" => 5,
|
58
|
-
"ラッシュさん" => 19,
|
59
|
-
"リアル" => 81,
|
60
|
-
"リチャード" => 80,
|
61
|
-
"リュウー" => 26,
|
62
|
-
"レオン" => 59,
|
63
|
-
"吉岡" => 6,
|
64
|
-
"久志" => 51,
|
65
|
-
"玉木宏" => 43,
|
66
|
-
"健二" => 70,
|
67
|
-
"佐伯さん" => 76,
|
68
|
-
"砂漠の狼" => 63,
|
69
|
-
"坂本竜馬の子孫" => 27,
|
70
|
-
"桜井" => 39,
|
71
|
-
"時任" => 42,
|
72
|
-
"実行委員" => 47,
|
73
|
-
"小松っち" => 75,
|
74
|
-
"松尾" => 23,
|
75
|
-
"水谷" => 11,
|
76
|
-
"袖まくり" => 60,
|
77
|
-
"太陽 " => 68,
|
78
|
-
"代官山" => 33,
|
79
|
-
"大嶽一史" => 77,
|
80
|
-
"拓真" => 31,
|
81
|
-
"達也の兄ちゃん" => 72,
|
82
|
-
"痴漢" => 15,
|
83
|
-
"中村健" => 4,
|
84
|
-
"田部" => 20,
|
85
|
-
"東大生" => 45,
|
86
|
-
"湯上谷" => 16,
|
87
|
-
"藤井" => 9,
|
88
|
-
"道明寺" => 61,
|
89
|
-
"風雲児達" => 86,
|
90
|
-
"北岡" => 62,
|
91
|
-
"野村" => 2,
|
92
|
-
"野茂" => 30,
|
93
|
-
"零" => 69,
|
94
|
-
"零" => 73,
|
95
|
-
"和田" => 48
|
96
|
-
}
|
17
|
+
|
18
|
+
@@categories = {}
|
19
|
+
|
20
|
+
Nokogiri.HTML(open(DOMAIN).read).css('dl').each do |dl|
|
21
|
+
if dl.children[0].inner_html.toutf8 == '惚れさせ男子達'
|
22
|
+
dl.children[2].children[1].children.to_a.delete_if{|node| node.class == Nokogiri::XML::Text}.each do |li|
|
23
|
+
a = li.child
|
24
|
+
@@categories[a.text.scan(/(.+?)(?:\([0-9]+\))?$/)[0][0]] = a[:href].scan(/cid=([0-9]+)/)[0][0]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
97
28
|
|
98
29
|
attr_reader :category, :page
|
99
30
|
|
100
31
|
def initialize(category, page = 0)
|
101
|
-
|
32
|
+
raise NotFoundError unless @@categories[category]
|
33
|
+
@category = @@categories[category]
|
102
34
|
@page = page =~ /^[0-9]+?\.\.[0-9]+?$/ ? eval(page) : page
|
103
35
|
end
|
104
36
|
|
@@ -133,11 +65,7 @@ class Misawa
|
|
133
65
|
end
|
134
66
|
|
135
67
|
def get_body(uri)
|
136
|
-
|
137
|
-
open(URI.encode(uri)).read
|
138
|
-
rescue OpenURI::HTTPError
|
139
|
-
return nil
|
140
|
-
end
|
68
|
+
open(URI.encode(uri)).read
|
141
69
|
end
|
142
70
|
|
143
71
|
def create_uri
|
metadata
CHANGED
@@ -1,59 +1,88 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: Ruby4Misawa
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- namusyaka
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-09-29 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: nokogiri
|
16
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
24
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
22
32
|
type: :development
|
23
|
-
|
24
|
-
|
25
|
-
|
33
|
+
version_requirements: *id001
|
34
|
+
description: !binary |
|
35
|
+
5Zyw542E44Gu44Of44K144Ov44OW44Ot44Kw44Gr44GC44KLVVJM44GM44Go
|
36
|
+
44KM44Gf44KK44CB44Gd44Gu44G+44G+55S75YOP44KS5L+d5a2Y44GX44Gf
|
37
|
+
44KK44Gn44GN44G+44GZ44CC
|
38
|
+
|
26
39
|
email: namusyaka@gmail.com
|
27
40
|
executables: []
|
41
|
+
|
28
42
|
extensions: []
|
43
|
+
|
29
44
|
extra_rdoc_files: []
|
30
|
-
|
45
|
+
|
46
|
+
files:
|
31
47
|
- README.rdoc
|
32
|
-
- Ruby4Misawa-0.1.
|
48
|
+
- Ruby4Misawa-0.1.2.gemspec
|
33
49
|
- Gemfile
|
34
50
|
- lib/Ruby4Misawa.rb
|
35
51
|
homepage: https://github.com/namusyaka/Ruby4Misawa
|
36
52
|
licenses: []
|
53
|
+
|
37
54
|
post_install_message:
|
38
55
|
rdoc_options: []
|
39
|
-
|
56
|
+
|
57
|
+
require_paths:
|
40
58
|
- lib
|
41
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
60
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
|
47
|
-
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
69
|
none: false
|
49
|
-
requirements:
|
50
|
-
- -
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
53
77
|
requirements: []
|
78
|
+
|
54
79
|
rubyforge_project:
|
55
|
-
rubygems_version: 1.8.
|
80
|
+
rubygems_version: 1.8.1
|
56
81
|
signing_key:
|
57
82
|
specification_version: 3
|
58
|
-
summary:
|
83
|
+
summary: !binary |
|
84
|
+
44K544Kv44Os44Kk44OU44Oz44Kw44Op44Kk44OW44Op44OqIGZvciDlnLDn
|
85
|
+
jYTjga7jg5/jgrXjg68=
|
86
|
+
|
59
87
|
test_files: []
|
88
|
+
|