cat_claw 0.0.1
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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +0 -0
- data/Rakefile +8 -0
- data/bin/catclaw +5 -0
- data/cat_claw.gemspec +22 -0
- data/lib/cat_claw/catcher.rb +35 -0
- data/lib/cat_claw/cats/ruby_china_cat.rb +53 -0
- data/lib/cat_claw/cats/stack_over_flow_cat.rb +44 -0
- data/lib/cat_claw/cats/v2ex_cat.rb +53 -0
- data/lib/cat_claw/cats/we_work_remotely_cat.rb +45 -0
- data/lib/cat_claw/version.rb +3 -0
- data/lib/cat_claw.rb +8 -0
- data/spec/lib/cat_claw_spec.rb +6 -0
- data/spec/spec_helper.rb +1 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f85a43495dd6671e20cbb57ed4fdfcc1fd00c9dc
|
4
|
+
data.tar.gz: d1688e1bd201f915bad724b5fd5c4b4ba2fee1d5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3ce7f6d8c8b1605d52abae170b033a30d44224b8ffd2bb110e3b59e3aca28b8aee8715de5ca690966f669992a5e169f4046131d084427d2ba109abd42367319c
|
7
|
+
data.tar.gz: 04709d9f3be0a176d81ca2b9b5ae584ab289eb0b1fbe6bdf07e214b451c990ed457afd891dc37e97601b9ee7668bdb01634d9684b915287016ad3c913afe48c6
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 yeer
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
File without changes
|
data/Rakefile
ADDED
data/bin/catclaw
ADDED
data/cat_claw.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/cat_claw/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["yeer"]
|
6
|
+
gem.email = ["athom@126.com"]
|
7
|
+
gem.description = %q{catching jobs from the web}
|
8
|
+
gem.summary = %q{gathering all remote jobs information from the internet}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "cat_claw"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = CatClaw::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency 'rake'
|
19
|
+
gem.add_development_dependency 'rspec'
|
20
|
+
gem.add_development_dependency 'nokogiri'
|
21
|
+
gem.license = 'MIT'
|
22
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module CatClaw
|
4
|
+
class Catcher
|
5
|
+
def initialize(arguments)
|
6
|
+
@arguments = arguments
|
7
|
+
@cats = [
|
8
|
+
CatClaw::RubyChinaCat.new,
|
9
|
+
CatClaw::V2EXCat.new,
|
10
|
+
CatClaw::WeWorkRemotelyCat.new,
|
11
|
+
CatClaw::StackOverFlowCat.new
|
12
|
+
]
|
13
|
+
end
|
14
|
+
|
15
|
+
def paw
|
16
|
+
parse_options
|
17
|
+
@cats.each do |cat|
|
18
|
+
p cat.paw
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def run
|
23
|
+
paw
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def parse_options
|
29
|
+
options = OptionParser.new
|
30
|
+
options.banner = "Usage: catclaw [options]"
|
31
|
+
options.on('-d', '--download', "Download all photos after pulling" ) { @cats.download = true }
|
32
|
+
options.parse!(@arguments)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'open-uri'
|
4
|
+
|
5
|
+
module CatClaw
|
6
|
+
class RubyChinaCat
|
7
|
+
KEYWORD = "远程"
|
8
|
+
attr_accessor :footprint
|
9
|
+
def initialize
|
10
|
+
@base_url = "https://ruby-china.org"
|
11
|
+
@footprint = {
|
12
|
+
source: "RubyChina",
|
13
|
+
jobs: [],
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def paw
|
18
|
+
3.times do |i|
|
19
|
+
whisper (i+1)
|
20
|
+
end
|
21
|
+
@footprint
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def whisper page
|
26
|
+
puts 'opening URI ... '
|
27
|
+
url = @base_url + "/jobs?page=" + page.to_s
|
28
|
+
doc = Nokogiri::HTML(open(url))
|
29
|
+
topics = doc.css(".topic .infos .title a")
|
30
|
+
topics.each do |t|
|
31
|
+
if t.text.match KEYWORD
|
32
|
+
url = @base_url + t.attr("href")
|
33
|
+
doc = Nokogiri::HTML(open(url))
|
34
|
+
#binding.pry
|
35
|
+
title = doc.css(".entry-title").text
|
36
|
+
content = doc.css(".entry-content").text
|
37
|
+
@footprint[:jobs] << {
|
38
|
+
url: url,
|
39
|
+
title: title,
|
40
|
+
description: content,
|
41
|
+
scope: "China",
|
42
|
+
job_type: "developer",
|
43
|
+
}
|
44
|
+
#p url
|
45
|
+
#p title
|
46
|
+
#p content
|
47
|
+
#p "---"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'open-uri'
|
4
|
+
|
5
|
+
module CatClaw
|
6
|
+
class StackOverFlowCat
|
7
|
+
attr_accessor :footprint
|
8
|
+
def initialize
|
9
|
+
@base_url = "http://careers.stackoverflow.com"
|
10
|
+
@footprint = {
|
11
|
+
source: "RubyChina",
|
12
|
+
jobs: [],
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def paw
|
17
|
+
whisper
|
18
|
+
@footprint
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def whisper
|
23
|
+
puts 'opening URI ... '
|
24
|
+
url = @base_url + "/jobs/remote"
|
25
|
+
doc = Nokogiri::HTML(open(url))
|
26
|
+
topics = doc.css(".jobs div h3 a")
|
27
|
+
topics.each do |t|
|
28
|
+
url = @base_url + t.attr("href")
|
29
|
+
doc = Nokogiri::HTML(open(url))
|
30
|
+
title = doc.css(".jobdetail div h1 a").text
|
31
|
+
content = doc.css(".description").text
|
32
|
+
@footprint[:jobs] << {
|
33
|
+
url: url,
|
34
|
+
title: title,
|
35
|
+
description: content,
|
36
|
+
scope: "World",
|
37
|
+
job_type: "developer",
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'open-uri'
|
4
|
+
|
5
|
+
module CatClaw
|
6
|
+
class V2EXCat
|
7
|
+
KEYWORD = "远程"
|
8
|
+
attr_accessor :footprint
|
9
|
+
def initialize
|
10
|
+
@base_url = "http://v2ex.com"
|
11
|
+
@footprint = {
|
12
|
+
source: "V2EX",
|
13
|
+
jobs: [],
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def paw
|
18
|
+
3.times do |i|
|
19
|
+
whisper (i+1)
|
20
|
+
end
|
21
|
+
@footprint
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def whisper page
|
26
|
+
puts 'opening URI ... '
|
27
|
+
url = @base_url + "/go/jobs?p=" + page.to_s
|
28
|
+
doc = Nokogiri::HTML(open(url))
|
29
|
+
topics = doc.css(".item_title a")
|
30
|
+
topics.each do |t|
|
31
|
+
if t.text.match KEYWORD
|
32
|
+
url = @base_url + t.attr("href")
|
33
|
+
doc = Nokogiri::HTML(open(url))
|
34
|
+
title = doc.css(".header h1").text
|
35
|
+
content = doc.css(".topic_content").text
|
36
|
+
@footprint[:jobs] << {
|
37
|
+
url: url,
|
38
|
+
title: title,
|
39
|
+
description: content,
|
40
|
+
scope: "China",
|
41
|
+
job_type: "developer",
|
42
|
+
}
|
43
|
+
#p url
|
44
|
+
#p title
|
45
|
+
#p content
|
46
|
+
#p "---"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'open-uri'
|
4
|
+
|
5
|
+
module CatClaw
|
6
|
+
class WeWorkRemotelyCat
|
7
|
+
attr_accessor :footprint
|
8
|
+
def initialize
|
9
|
+
@base_url = "https://weworkremotely.com"
|
10
|
+
@footprint = {
|
11
|
+
source: "37Signal",
|
12
|
+
jobs: [],
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def paw
|
17
|
+
whisper "/categories/1/jobs", "design"
|
18
|
+
whisper "/categories/2/jobs", "developer"
|
19
|
+
@footprint
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def whisper sub_url, jt
|
24
|
+
puts 'opening URI ... '
|
25
|
+
url = @base_url + sub_url
|
26
|
+
doc = Nokogiri::HTML(open(url))
|
27
|
+
topics = doc.css("article ul li a")
|
28
|
+
topics.each do |t|
|
29
|
+
url = @base_url + t.attr("href")
|
30
|
+
doc = Nokogiri::HTML(open(url))
|
31
|
+
title = doc.css(".listing-header-container h1").text
|
32
|
+
next if title.empty?
|
33
|
+
content = doc.css(".listing-container").text
|
34
|
+
@footprint[:jobs] << {
|
35
|
+
url: url,
|
36
|
+
title: title,
|
37
|
+
description: content,
|
38
|
+
scope: "World",
|
39
|
+
job_type: jt,
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
data/lib/cat_claw.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'cat_claw'
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cat_claw
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- yeer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: catching jobs from the web
|
56
|
+
email:
|
57
|
+
- athom@126.com
|
58
|
+
executables:
|
59
|
+
- catclaw
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/catclaw
|
69
|
+
- cat_claw.gemspec
|
70
|
+
- lib/cat_claw.rb
|
71
|
+
- lib/cat_claw/catcher.rb
|
72
|
+
- lib/cat_claw/cats/ruby_china_cat.rb
|
73
|
+
- lib/cat_claw/cats/stack_over_flow_cat.rb
|
74
|
+
- lib/cat_claw/cats/v2ex_cat.rb
|
75
|
+
- lib/cat_claw/cats/we_work_remotely_cat.rb
|
76
|
+
- lib/cat_claw/version.rb
|
77
|
+
- spec/lib/cat_claw_spec.rb
|
78
|
+
- spec/spec_helper.rb
|
79
|
+
homepage: ''
|
80
|
+
licenses:
|
81
|
+
- MIT
|
82
|
+
metadata: {}
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.2.2
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: gathering all remote jobs information from the internet
|
103
|
+
test_files:
|
104
|
+
- spec/lib/cat_claw_spec.rb
|
105
|
+
- spec/spec_helper.rb
|