grank 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dcbdd50a543e824ff7c73296b6b827bb61f0b0b3
4
+ data.tar.gz: 8d365d6f3ccc1000c3c9df0b805e92cf7eb42536
5
+ SHA512:
6
+ metadata.gz: 9899a9de9ab3acad7800b8cee6c478fc54d4259020449d7c8b1793f030612e7dc25fbc610bb5687f1b4bd945d9e9f19b7576b1db5488d166c63dae185f87b90a
7
+ data.tar.gz: 412278ec232bea26c7e0246d509b075008a3707e2593a5bedc9251bfdbd50ea5de6d968a1dc4856a2d2addab6767b573c400b7acef3be79d2b744feca51b1501
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in grank.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 kazuhiko yamashita
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+ # Grank
2
+
3
+ Get google pagerank for ruby
4
+
5
+ ## Installation
6
+
7
+ ```ruby
8
+ gem 'grank'
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Grank.get_page_rank('hoge.com') => 3
14
+
15
+ ## Author
16
+ * ka-yamashita
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "grank"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'grank/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "grank"
8
+ spec.version = Grank::VERSION
9
+ spec.authors = ["kazuhiko yamashita"]
10
+ spec.email = ["wwww.kazu.com@gmail.com"]
11
+
12
+ spec.summary = %q{get google pagerank}
13
+ spec.description = %q{get google pagerank}
14
+ spec.homepage = "http://ten-snapon.com"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.8"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
@@ -0,0 +1,27 @@
1
+ require "grank/version"
2
+ # coding: utf-8
3
+ require 'open-uri'
4
+
5
+ module Grank
6
+ def get_page_rank(domain_name, google='toolbarqueries.google.com')
7
+ seed = "Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer."
8
+ tmp = 0x01020345
9
+
10
+ ## $BF|K\8l%I%a%$%s$bBP1~$7$F$$$^$9(B
11
+ domain_name = SimpleIDN.to_ascii(domain_name)
12
+
13
+ domain_name.length.times do |i|
14
+ tmp ^= seed[i%seed.length].ord ^ domain_name[i].ord
15
+ tmp = ((tmp >> 23) & 0x1ff) | tmp << 9
16
+ end
17
+
18
+ tmp = -(~(tmp & 0xFFFFFFFF) + 1)
19
+ ch = sprintf('8%x', tmp);
20
+
21
+ url = 'http://%s/tbr?client=navclient-auto&ch=%s&features=Rank&q=info:%s'
22
+ url = sprintf(url, google , ch, domain_name)
23
+ $1 if open(url).read.strip =~ /([0-9]+)$/
24
+ rescue
25
+ Rails.logger.error("$B%Z!<%8%i%s%/$N<hF@$K<:GT$7$^$7$?(B $B%I%a%$%sL>(B:#{domain_name}")
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ module Grank
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: grank
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - kazuhiko yamashita
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-03-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: get google pagerank
42
+ email:
43
+ - wwww.kazu.com@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".travis.yml"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/console
55
+ - bin/setup
56
+ - grank.gemspec
57
+ - lib/grank.rb
58
+ - lib/grank/version.rb
59
+ homepage: http://ten-snapon.com
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.2.2
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: get google pagerank
83
+ test_files: []