crown 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/crown.gemspec +44 -34
- data/example/annual.rb +69 -0
- data/example/fbcount.rb +54 -0
- data/example/hbcount.rb +52 -0
- data/example/hbentry.rb +61 -0
- data/example/hbtrace.rb +53 -0
- data/example/rtcount.rb +57 -0
- data/example/sbmcount.rb +54 -0
- data/example/twcount.rb +55 -0
- data/lib/crown.rb +2 -1
- metadata +31 -12
- data/.gitignore +0 -5
data/ChangeLog
CHANGED
data/Rakefile
CHANGED
@@ -12,6 +12,7 @@ begin
|
|
12
12
|
gem.authors = ["clown"]
|
13
13
|
gem.add_dependency('json')
|
14
14
|
gem.add_dependency('nokogiri')
|
15
|
+
gem.add_dependency('amazon-ecs')
|
15
16
|
gem.add_development_dependency "thoughtbot-shoulda"
|
16
17
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
18
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/crown.gemspec
CHANGED
@@ -1,58 +1,64 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{crown}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["clown"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-04-03}
|
13
13
|
s.description = %q{crown is uncategorized ruby libraries, which is added according to author's mood :-D}
|
14
14
|
s.email = %q{tt.clown@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"ChangeLog",
|
17
|
-
|
18
|
-
|
17
|
+
"LICENSE",
|
18
|
+
"README.rdoc"
|
19
19
|
]
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
22
|
+
"ChangeLog",
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"crown.gemspec",
|
28
|
+
"example/annual.rb",
|
29
|
+
"example/fbcount.rb",
|
30
|
+
"example/hbcount.rb",
|
31
|
+
"example/hbentry.rb",
|
32
|
+
"example/hbtrace.rb",
|
33
|
+
"example/rtcount.rb",
|
34
|
+
"example/sbmcount.rb",
|
35
|
+
"example/twcount.rb",
|
36
|
+
"lib/crown.rb",
|
37
|
+
"lib/crown/backtype.rb",
|
38
|
+
"lib/crown/buzzurl.rb",
|
39
|
+
"lib/crown/delicious.rb",
|
40
|
+
"lib/crown/facebook.rb",
|
41
|
+
"lib/crown/hatena.rb",
|
42
|
+
"lib/crown/hatena/bookmark.rb",
|
43
|
+
"lib/crown/http.rb",
|
44
|
+
"lib/crown/livedoor.rb",
|
45
|
+
"lib/crown/livedoor/clip.rb",
|
46
|
+
"lib/crown/livedoor/reader.rb",
|
47
|
+
"lib/crown/topsy.rb",
|
48
|
+
"lib/crown/tweetmeme.rb",
|
49
|
+
"lib/crown/twitter.rb",
|
50
|
+
"lib/crown/yahoo.rb",
|
51
|
+
"lib/crown/yahoo/bookmark.rb",
|
52
|
+
"test/crown_test.rb",
|
53
|
+
"test/test_helper.rb"
|
47
54
|
]
|
48
55
|
s.homepage = %q{http://github.com/clown/crown}
|
49
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
50
56
|
s.require_paths = ["lib"]
|
51
|
-
s.rubygems_version = %q{1.
|
57
|
+
s.rubygems_version = %q{1.7.1}
|
52
58
|
s.summary = %q{uncategorized ruby libraries.}
|
53
59
|
s.test_files = [
|
54
60
|
"test/crown_test.rb",
|
55
|
-
|
61
|
+
"test/test_helper.rb"
|
56
62
|
]
|
57
63
|
|
58
64
|
if s.respond_to? :specification_version then
|
@@ -61,15 +67,19 @@ Gem::Specification.new do |s|
|
|
61
67
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
62
68
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
63
69
|
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
70
|
+
s.add_runtime_dependency(%q<amazon-ecs>, [">= 0"])
|
64
71
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
65
72
|
else
|
66
73
|
s.add_dependency(%q<json>, [">= 0"])
|
67
74
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
75
|
+
s.add_dependency(%q<amazon-ecs>, [">= 0"])
|
68
76
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
69
77
|
end
|
70
78
|
else
|
71
79
|
s.add_dependency(%q<json>, [">= 0"])
|
72
80
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
81
|
+
s.add_dependency(%q<amazon-ecs>, [">= 0"])
|
73
82
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
74
83
|
end
|
75
84
|
end
|
85
|
+
|
data/example/annual.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
#!/usr/bin/ruby -Ku
|
2
|
+
# --------------------------------------------------------------------------- #
|
3
|
+
#
|
4
|
+
# annual.rb
|
5
|
+
#
|
6
|
+
# Copyright (c) 2008 - 2011, clown.
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# - Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
# - Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in the
|
16
|
+
# documentation and/or other materials provided with the distribution.
|
17
|
+
# - No names of its contributors may be used to endorse or promote
|
18
|
+
# products derived from this software without specific prior written
|
19
|
+
# permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
27
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
#
|
33
|
+
# --------------------------------------------------------------------------- #
|
34
|
+
require 'rubygems'
|
35
|
+
require 'crown/hatena/bookmark'
|
36
|
+
|
37
|
+
PREFIX = "entrylist?sort=count&url="
|
38
|
+
|
39
|
+
# --------------------------------------------------------------------------- #
|
40
|
+
#
|
41
|
+
# 人気のエントリーから引数に指定した年の記事の URL を抽出する.
|
42
|
+
#
|
43
|
+
# Parameters
|
44
|
+
# ARGV[0]: 対象とするサイトの URL
|
45
|
+
# ARGV[1]: 対象とする年
|
46
|
+
# ARGV[2]: 取得件数(オプション)
|
47
|
+
#
|
48
|
+
# --------------------------------------------------------------------------- #
|
49
|
+
if (ARGV.length < 2)
|
50
|
+
puts("usage annual.rb URL year [num_of_url]")
|
51
|
+
exit
|
52
|
+
end
|
53
|
+
|
54
|
+
year = ARGV[1].to_i
|
55
|
+
limit = (ARGV.length > 2) ? ARGV[2].to_i : 10
|
56
|
+
i = 0
|
57
|
+
Crown::Hatena::Bookmark.each(PREFIX + ARGV[0]) { |entry|
|
58
|
+
v = entry.users.to_a.sort { |x, y|
|
59
|
+
x[1].date <=> y[1].date
|
60
|
+
}
|
61
|
+
|
62
|
+
if (v != nil && !v.empty? && v[0][1].date.year == year)
|
63
|
+
printf("+ %s (%d users)\n", entry.uri, entry.count)
|
64
|
+
i += 1
|
65
|
+
break if (i >= limit)
|
66
|
+
end
|
67
|
+
|
68
|
+
sleep 5
|
69
|
+
}
|
data/example/fbcount.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/ruby -Ku
|
2
|
+
# --------------------------------------------------------------------------- #
|
3
|
+
#
|
4
|
+
# fbcount.rb
|
5
|
+
#
|
6
|
+
# Copyright (c) 2008 - 2011, clown.
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# - Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
# - Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in the
|
16
|
+
# documentation and/or other materials provided with the distribution.
|
17
|
+
# - No names of its contributors may be used to endorse or promote
|
18
|
+
# products derived from this software without specific prior written
|
19
|
+
# permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
27
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
#
|
33
|
+
# --------------------------------------------------------------------------- #
|
34
|
+
require 'rubygems'
|
35
|
+
require 'crown'
|
36
|
+
|
37
|
+
# --------------------------------------------------------------------------- #
|
38
|
+
#
|
39
|
+
# 指定された URL に関する Facebook の各種カウント情報を取得する.
|
40
|
+
#
|
41
|
+
# Parameters:
|
42
|
+
# ARGV[0]: URL1
|
43
|
+
# ARGV[1]: URL2
|
44
|
+
# ...
|
45
|
+
#
|
46
|
+
# --------------------------------------------------------------------------- #
|
47
|
+
ARGV.each { |uri|
|
48
|
+
info = Crown::Facebook.count(uri)
|
49
|
+
printf("%s\n", uri)
|
50
|
+
printf(" + like : %8d\n", info.like)
|
51
|
+
printf(" + total : %8d\n", info.total)
|
52
|
+
printf(" + share : %8d\n", info.share)
|
53
|
+
printf(" + click : %8d\n", info.click)
|
54
|
+
}
|
data/example/hbcount.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/ruby -Ku
|
2
|
+
# --------------------------------------------------------------------------- #
|
3
|
+
#
|
4
|
+
# hbcount.rb
|
5
|
+
#
|
6
|
+
# Copyright (c) 2008 - 2011, clown.
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# - Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
# - Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in the
|
16
|
+
# documentation and/or other materials provided with the distribution.
|
17
|
+
# - No names of its contributors may be used to endorse or promote
|
18
|
+
# products derived from this software without specific prior written
|
19
|
+
# permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
27
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
#
|
33
|
+
# --------------------------------------------------------------------------- #
|
34
|
+
require 'rubygems'
|
35
|
+
require 'crown/hatena/bookmark'
|
36
|
+
|
37
|
+
# --------------------------------------------------------------------------- #
|
38
|
+
#
|
39
|
+
# 指定されたファイルに記載されている URL のはてなブックマーク数を取得する.
|
40
|
+
#
|
41
|
+
# Parameters:
|
42
|
+
# ARGV[0]: URL の記載されているテキストファイル
|
43
|
+
#
|
44
|
+
# --------------------------------------------------------------------------- #
|
45
|
+
File.open(ARGV[0]) { |file|
|
46
|
+
n = 1
|
47
|
+
file.each { |line|
|
48
|
+
line.chomp!
|
49
|
+
printf("%3d %5d %s\n", n, Crown::Hatena::Bookmark.count(line), line)
|
50
|
+
n += 1
|
51
|
+
}
|
52
|
+
}
|
data/example/hbentry.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/usr/bin/ruby -Ku
|
2
|
+
# --------------------------------------------------------------------------- #
|
3
|
+
#
|
4
|
+
# hbentry.rb
|
5
|
+
#
|
6
|
+
# Copyright (c) 2008 - 2011, clown.
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# - Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
# - Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in the
|
16
|
+
# documentation and/or other materials provided with the distribution.
|
17
|
+
# - No names of its contributors may be used to endorse or promote
|
18
|
+
# products derived from this software without specific prior written
|
19
|
+
# permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
27
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
#
|
33
|
+
# --------------------------------------------------------------------------- #
|
34
|
+
require 'rubygems'
|
35
|
+
require 'crown/hatena/bookmark'
|
36
|
+
|
37
|
+
# --------------------------------------------------------------------------- #
|
38
|
+
#
|
39
|
+
# 引数に指定されたファイルに記載されている URL のはてなブックマークの
|
40
|
+
# 各種情報を取得して出力する.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# ARGV[0]: URL の記載されているテキストファイル
|
44
|
+
#
|
45
|
+
# --------------------------------------------------------------------------- #
|
46
|
+
File.open(ARGV[0]) { |file|
|
47
|
+
file.each { |line|
|
48
|
+
line.chomp!
|
49
|
+
result = Crown::Hatena::Bookmark.get(line)
|
50
|
+
printf("%s (%d users)\n", result.uri, result.count)
|
51
|
+
|
52
|
+
# ブクマした日付で昇順にソートした後,出力する.
|
53
|
+
sorted = result.users.to_a.sort { |x, y|
|
54
|
+
x[1].date <=> y[1].date
|
55
|
+
}
|
56
|
+
|
57
|
+
sorted.each { |elem|
|
58
|
+
printf("\t%-20s %s\n", elem[0], elem[1].date.to_s)
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
data/example/hbtrace.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/ruby -Ku
|
2
|
+
# --------------------------------------------------------------------------- #
|
3
|
+
#
|
4
|
+
# hbtrace.rb
|
5
|
+
#
|
6
|
+
# Copyright (c) 2008 - 2011, clown.
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# - Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
# - Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in the
|
16
|
+
# documentation and/or other materials provided with the distribution.
|
17
|
+
# - No names of its contributors may be used to endorse or promote
|
18
|
+
# products derived from this software without specific prior written
|
19
|
+
# permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
27
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
#
|
33
|
+
# --------------------------------------------------------------------------- #
|
34
|
+
require 'rubygems'
|
35
|
+
require 'crown/hatena/bookmark'
|
36
|
+
|
37
|
+
# --------------------------------------------------------------------------- #
|
38
|
+
#
|
39
|
+
# 引数に指定されたパスに表示されている各はてなブックマーク URL の情報を
|
40
|
+
# 取得して出力する.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# ARGV[0]: はてなブックマーク URL の一覧が記載されているパス
|
44
|
+
# ARGV[1]: 最大出力件数
|
45
|
+
#
|
46
|
+
# --------------------------------------------------------------------------- #
|
47
|
+
limit = (ARGV.length > 1) ? ARGV[1].to_i : 10
|
48
|
+
i = 1
|
49
|
+
Crown::Hatena::Bookmark.each(ARGV[0]) { |entry|
|
50
|
+
printf("%3d %s (%d users)\n", i, entry.uri, entry.count)
|
51
|
+
break if (i >= limit)
|
52
|
+
i += 1
|
53
|
+
}
|
data/example/rtcount.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/ruby -Ku
|
2
|
+
# --------------------------------------------------------------------------- #
|
3
|
+
#
|
4
|
+
# rtcount.rb
|
5
|
+
#
|
6
|
+
# Copyright (c) 2008 - 2011, clown.
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# - Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
# - Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in the
|
16
|
+
# documentation and/or other materials provided with the distribution.
|
17
|
+
# - No names of its contributors may be used to endorse or promote
|
18
|
+
# products derived from this software without specific prior written
|
19
|
+
# permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
27
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
#
|
33
|
+
# --------------------------------------------------------------------------- #
|
34
|
+
require 'rubygems'
|
35
|
+
require 'crown'
|
36
|
+
|
37
|
+
# --------------------------------------------------------------------------- #
|
38
|
+
# TODO: BackType の API key をあらかじめ設定しておく.
|
39
|
+
# --------------------------------------------------------------------------- #
|
40
|
+
BACKTYPE_APIKEY = "your_api_key"
|
41
|
+
|
42
|
+
# --------------------------------------------------------------------------- #
|
43
|
+
#
|
44
|
+
# 指定された URL に関する Twitter 検索関連から提供されるの呟き数を取得する.
|
45
|
+
#
|
46
|
+
# Parameters:
|
47
|
+
# ARGV[0]: URL1
|
48
|
+
# ARGV[1]: URL2
|
49
|
+
# ...
|
50
|
+
#
|
51
|
+
# --------------------------------------------------------------------------- #
|
52
|
+
ARGV.each { |uri|
|
53
|
+
printf("%s\n", uri)
|
54
|
+
printf(" + topsy : %8d\n", Crown::Topsy.count(uri))
|
55
|
+
printf(" + tweetmeme : %8d\n", Crown::TweetMeme.count(uri))
|
56
|
+
printf(" + backtype : %8d\n", Crown::BackType.count(uri, BACKTYPE_APIKEY))
|
57
|
+
}
|
data/example/sbmcount.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/ruby -Ku
|
2
|
+
# --------------------------------------------------------------------------- #
|
3
|
+
#
|
4
|
+
# sbmcount.rb
|
5
|
+
#
|
6
|
+
# Copyright (c) 2008 - 2011, clown.
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# - Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
# - Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in the
|
16
|
+
# documentation and/or other materials provided with the distribution.
|
17
|
+
# - No names of its contributors may be used to endorse or promote
|
18
|
+
# products derived from this software without specific prior written
|
19
|
+
# permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
27
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
#
|
33
|
+
# --------------------------------------------------------------------------- #
|
34
|
+
require 'rubygems'
|
35
|
+
require 'crown'
|
36
|
+
|
37
|
+
# --------------------------------------------------------------------------- #
|
38
|
+
#
|
39
|
+
# 指定された URL に関する各種 SBM カウント情報を取得する.
|
40
|
+
#
|
41
|
+
# Parameters:
|
42
|
+
# ARGV[0]: URL1
|
43
|
+
# ARGV[1]: URL2
|
44
|
+
# ...
|
45
|
+
#
|
46
|
+
# --------------------------------------------------------------------------- #
|
47
|
+
ARGV.each { |uri|
|
48
|
+
printf("%s\n", uri)
|
49
|
+
printf(" + hatena : %6d\n", Crown::Hatena::Bookmark.count(uri))
|
50
|
+
printf(" + livedoor : %6d\n", Crown::Livedoor::Clip.count(uri))
|
51
|
+
printf(" + delicious : %6d\n", Crown::Delicious.count(uri))
|
52
|
+
printf(" + buzzurl : %6d\n", Crown::Buzzurl.count(uri))
|
53
|
+
printf(" + yahoo : %6d\n", Crown::Yahoo::Bookmark.count(uri))
|
54
|
+
}
|
data/example/twcount.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/ruby -Ku
|
2
|
+
# --------------------------------------------------------------------------- #
|
3
|
+
#
|
4
|
+
# twcount.rb
|
5
|
+
#
|
6
|
+
# Copyright (c) 2008 - 2011, clown.
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# - Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
# - Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in the
|
16
|
+
# documentation and/or other materials provided with the distribution.
|
17
|
+
# - No names of its contributors may be used to endorse or promote
|
18
|
+
# products derived from this software without specific prior written
|
19
|
+
# permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
27
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
#
|
33
|
+
# --------------------------------------------------------------------------- #
|
34
|
+
require 'rubygems'
|
35
|
+
require 'crown'
|
36
|
+
|
37
|
+
# --------------------------------------------------------------------------- #
|
38
|
+
#
|
39
|
+
# 指定された Twitter ユーザ名に関する各種カウント情報を取得する.
|
40
|
+
#
|
41
|
+
# Parameters:
|
42
|
+
# ARGV[0]: ユーザ名1 (screen_name)
|
43
|
+
# ARGV[1]: ユーザ名2
|
44
|
+
# ...
|
45
|
+
#
|
46
|
+
# --------------------------------------------------------------------------- #
|
47
|
+
ARGV.each { |screen_name|
|
48
|
+
info = Crown::Twitter.count(screen_name)
|
49
|
+
printf("%s\n", screen_name)
|
50
|
+
printf(" + status : %8d\n", info.status)
|
51
|
+
printf(" + friend : %8d\n", info.friend)
|
52
|
+
printf(" + follower : %8d\n", info.follower)
|
53
|
+
printf(" + favorite : %8d\n", info.favorite)
|
54
|
+
printf(" + list : %8d\n", info.list)
|
55
|
+
}
|
data/lib/crown.rb
CHANGED
@@ -34,6 +34,7 @@
|
|
34
34
|
$:.unshift(File.dirname(__FILE__))
|
35
35
|
|
36
36
|
require 'crown/http'
|
37
|
+
require 'crown/amazon'
|
37
38
|
require 'crown/delicious'
|
38
39
|
require 'crown/hatena'
|
39
40
|
require 'crown/livedoor'
|
@@ -46,5 +47,5 @@ require 'crown/backtype'
|
|
46
47
|
require 'crown/facebook'
|
47
48
|
|
48
49
|
module Crown
|
49
|
-
VERSION = '0.0.
|
50
|
+
VERSION = '0.0.6'
|
50
51
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- clown
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-04-03 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: json
|
@@ -47,7 +46,7 @@ dependencies:
|
|
47
46
|
type: :runtime
|
48
47
|
version_requirements: *id002
|
49
48
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
49
|
+
name: amazon-ecs
|
51
50
|
prerelease: false
|
52
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
52
|
none: false
|
@@ -58,8 +57,22 @@ dependencies:
|
|
58
57
|
segments:
|
59
58
|
- 0
|
60
59
|
version: "0"
|
61
|
-
type: :
|
60
|
+
type: :runtime
|
62
61
|
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: thoughtbot-shoulda
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
type: :development
|
75
|
+
version_requirements: *id004
|
63
76
|
description: crown is uncategorized ruby libraries, which is added according to author's mood :-D
|
64
77
|
email: tt.clown@gmail.com
|
65
78
|
executables: []
|
@@ -72,13 +85,20 @@ extra_rdoc_files:
|
|
72
85
|
- README.rdoc
|
73
86
|
files:
|
74
87
|
- .document
|
75
|
-
- .gitignore
|
76
88
|
- ChangeLog
|
77
89
|
- LICENSE
|
78
90
|
- README.rdoc
|
79
91
|
- Rakefile
|
80
92
|
- VERSION
|
81
93
|
- crown.gemspec
|
94
|
+
- example/annual.rb
|
95
|
+
- example/fbcount.rb
|
96
|
+
- example/hbcount.rb
|
97
|
+
- example/hbentry.rb
|
98
|
+
- example/hbtrace.rb
|
99
|
+
- example/rtcount.rb
|
100
|
+
- example/sbmcount.rb
|
101
|
+
- example/twcount.rb
|
82
102
|
- lib/crown.rb
|
83
103
|
- lib/crown/backtype.rb
|
84
104
|
- lib/crown/buzzurl.rb
|
@@ -97,13 +117,12 @@ files:
|
|
97
117
|
- lib/crown/yahoo/bookmark.rb
|
98
118
|
- test/crown_test.rb
|
99
119
|
- test/test_helper.rb
|
100
|
-
has_rdoc: true
|
101
120
|
homepage: http://github.com/clown/crown
|
102
121
|
licenses: []
|
103
122
|
|
104
123
|
post_install_message:
|
105
|
-
rdoc_options:
|
106
|
-
|
124
|
+
rdoc_options: []
|
125
|
+
|
107
126
|
require_paths:
|
108
127
|
- lib
|
109
128
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -127,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
146
|
requirements: []
|
128
147
|
|
129
148
|
rubyforge_project:
|
130
|
-
rubygems_version: 1.
|
149
|
+
rubygems_version: 1.7.1
|
131
150
|
signing_key:
|
132
151
|
specification_version: 3
|
133
152
|
summary: uncategorized ruby libraries.
|