spider_rails 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/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +32 -0
- data/lib/spider_rails.rb +4 -0
- data/lib/spider_rails/bilibili.rb +68 -0
- data/lib/spider_rails/common.rb +62 -0
- data/lib/spider_rails/google_dict.rb +91 -0
- data/lib/spider_rails/hl.rb +13 -0
- data/lib/spider_rails/ji_ying.rb +61 -0
- data/lib/spider_rails/sample_data.rb +10 -0
- data/lib/spider_rails/spread_sheet.rb +32 -0
- data/lib/spider_rails/version.rb +3 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/anis.js +2 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/anis.css +4 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/anis_controller.rb +58 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/anis_helper.rb +2 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/ani.rb +2 -0
- data/test/dummy/app/views/anis/_form.html.erb +25 -0
- data/test/dummy/app/views/anis/edit.html.erb +6 -0
- data/test/dummy/app/views/anis/index.html.erb +29 -0
- data/test/dummy/app/views/anis/new.html.erb +5 -0
- data/test/dummy/app/views/anis/show.html.erb +14 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130714091905_create_anis.rb +10 -0
- data/test/dummy/db/schema.rb +23 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +21 -0
- data/test/dummy/log/test.log +160 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/tmp/pids/server.pid +1 -0
- data/test/ji_ying_test.rb +58 -0
- data/test/libpeerconnection.log +0 -0
- data/test/spider_rails_test.rb +7 -0
- data/test/test_helper.rb +18 -0
- metadata +189 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/422.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The change you wanted was rejected.</h1>
|
54
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/500.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>We're sorry, but something went wrong.</h1>
|
54
|
+
</div>
|
55
|
+
<p>If you are the application owner check the logs for more information.</p>
|
56
|
+
</body>
|
57
|
+
</html>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
13201
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
class JiYingTest < ActiveSupport::TestCase
|
4
|
+
include ::Spider
|
5
|
+
|
6
|
+
def setup
|
7
|
+
Browser.close_all_chromes
|
8
|
+
@b = Browser.open_browser "http://bt.ktxp.com/search.php?keyword=%E8%AF%B8%E7%A5%9E&sort_id=28&field=title&order=&page=1"
|
9
|
+
@jy = Spider::JiYing.new @b
|
10
|
+
|
11
|
+
html = Nokogiri::HTML.parse @b.html
|
12
|
+
@e = html.css('.ltext').first
|
13
|
+
end
|
14
|
+
|
15
|
+
def teardown
|
16
|
+
@b.close
|
17
|
+
end
|
18
|
+
|
19
|
+
test 'get' do
|
20
|
+
@jy.get(@e)
|
21
|
+
assert_not_nil @jy.ani[:title]
|
22
|
+
assert_not_nil @jy.ani[:torrent]
|
23
|
+
end
|
24
|
+
|
25
|
+
test 'single_filter animation name include "外挂"' do
|
26
|
+
@jy.ani = {title: "外挂"}
|
27
|
+
assert_not_nil @jy.ani[:title]
|
28
|
+
@jy.ani = {title: nil}
|
29
|
+
assert_nil(@jy.ani[:title])
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
test 'save' do
|
34
|
+
assert_difference('Ani.count', +1) do
|
35
|
+
@jy.ani = {title: '魔法', torrent: 'http://baidu.com'}
|
36
|
+
@jy.save Ani
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
test 'torrent url should has full text when single finish' do
|
41
|
+
assert_match(/http:\/\/bt\.ktxp\.com\/down.*/, @jy.ani[:torrent])
|
42
|
+
end
|
43
|
+
|
44
|
+
test 'full_page' do
|
45
|
+
assert_nothing_raised do
|
46
|
+
@jy.full_page 1
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
test 'final_page' do
|
51
|
+
|
52
|
+
assert_operator(@jy.final_page, :>=, 3)
|
53
|
+
end
|
54
|
+
|
55
|
+
test 'full_site' do
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
File without changes
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
8
|
+
#Load lib files
|
9
|
+
PROJECT_NAME = File.expand_path('../..', __FILE__).split('/').last
|
10
|
+
require File.expand_path("../../lib/#{PROJECT_NAME}", __FILE__)
|
11
|
+
|
12
|
+
# Load support files
|
13
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
14
|
+
|
15
|
+
# Load fixtures from the engine
|
16
|
+
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
17
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spider_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- zhuxingruo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
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
|
+
description: nil
|
42
|
+
email:
|
43
|
+
- zhuxingruo3@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- lib/spider_rails/common.rb
|
49
|
+
- lib/spider_rails/version.rb
|
50
|
+
- lib/spider_rails/bilibili.rb
|
51
|
+
- lib/spider_rails/sample_data.rb
|
52
|
+
- lib/spider_rails/spread_sheet.rb
|
53
|
+
- lib/spider_rails/google_dict.rb
|
54
|
+
- lib/spider_rails/ji_ying.rb
|
55
|
+
- lib/spider_rails/hl.rb
|
56
|
+
- lib/spider_rails.rb
|
57
|
+
- MIT-LICENSE
|
58
|
+
- Rakefile
|
59
|
+
- README.rdoc
|
60
|
+
- test/test_helper.rb
|
61
|
+
- test/libpeerconnection.log
|
62
|
+
- test/spider_rails_test.rb
|
63
|
+
- test/dummy/bin/bundle
|
64
|
+
- test/dummy/bin/rails
|
65
|
+
- test/dummy/bin/rake
|
66
|
+
- test/dummy/tmp/pids/server.pid
|
67
|
+
- test/dummy/config.ru
|
68
|
+
- test/dummy/app/models/ani.rb
|
69
|
+
- test/dummy/app/helpers/anis_helper.rb
|
70
|
+
- test/dummy/app/helpers/application_helper.rb
|
71
|
+
- test/dummy/app/assets/stylesheets/scaffold.css
|
72
|
+
- test/dummy/app/assets/stylesheets/application.css
|
73
|
+
- test/dummy/app/assets/stylesheets/anis.css
|
74
|
+
- test/dummy/app/assets/javascripts/anis.js
|
75
|
+
- test/dummy/app/assets/javascripts/application.js
|
76
|
+
- test/dummy/app/controllers/application_controller.rb
|
77
|
+
- test/dummy/app/controllers/anis_controller.rb
|
78
|
+
- test/dummy/app/views/anis/_form.html.erb
|
79
|
+
- test/dummy/app/views/anis/edit.html.erb
|
80
|
+
- test/dummy/app/views/anis/index.html.erb
|
81
|
+
- test/dummy/app/views/anis/show.html.erb
|
82
|
+
- test/dummy/app/views/anis/new.html.erb
|
83
|
+
- test/dummy/app/views/layouts/application.html.erb
|
84
|
+
- test/dummy/config/routes.rb
|
85
|
+
- test/dummy/config/environments/test.rb
|
86
|
+
- test/dummy/config/environments/production.rb
|
87
|
+
- test/dummy/config/environments/development.rb
|
88
|
+
- test/dummy/config/boot.rb
|
89
|
+
- test/dummy/config/database.yml
|
90
|
+
- test/dummy/config/application.rb
|
91
|
+
- test/dummy/config/initializers/secret_token.rb
|
92
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
93
|
+
- test/dummy/config/initializers/inflections.rb
|
94
|
+
- test/dummy/config/initializers/mime_types.rb
|
95
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
96
|
+
- test/dummy/config/initializers/session_store.rb
|
97
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
98
|
+
- test/dummy/config/environment.rb
|
99
|
+
- test/dummy/config/locales/en.yml
|
100
|
+
- test/dummy/log/development.log
|
101
|
+
- test/dummy/log/test.log
|
102
|
+
- test/dummy/public/422.html
|
103
|
+
- test/dummy/public/404.html
|
104
|
+
- test/dummy/public/500.html
|
105
|
+
- test/dummy/public/favicon.ico
|
106
|
+
- test/dummy/Rakefile
|
107
|
+
- test/dummy/README.rdoc
|
108
|
+
- test/dummy/db/migrate/20130714091905_create_anis.rb
|
109
|
+
- test/dummy/db/development.sqlite3
|
110
|
+
- test/dummy/db/schema.rb
|
111
|
+
- test/dummy/db/test.sqlite3
|
112
|
+
- test/ji_ying_test.rb
|
113
|
+
homepage: http://zxr.baidu.com
|
114
|
+
licenses: []
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements: []
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 2.0.5
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: nil
|
136
|
+
test_files:
|
137
|
+
- test/test_helper.rb
|
138
|
+
- test/libpeerconnection.log
|
139
|
+
- test/spider_rails_test.rb
|
140
|
+
- test/dummy/bin/bundle
|
141
|
+
- test/dummy/bin/rails
|
142
|
+
- test/dummy/bin/rake
|
143
|
+
- test/dummy/tmp/pids/server.pid
|
144
|
+
- test/dummy/config.ru
|
145
|
+
- test/dummy/app/models/ani.rb
|
146
|
+
- test/dummy/app/helpers/anis_helper.rb
|
147
|
+
- test/dummy/app/helpers/application_helper.rb
|
148
|
+
- test/dummy/app/assets/stylesheets/scaffold.css
|
149
|
+
- test/dummy/app/assets/stylesheets/application.css
|
150
|
+
- test/dummy/app/assets/stylesheets/anis.css
|
151
|
+
- test/dummy/app/assets/javascripts/anis.js
|
152
|
+
- test/dummy/app/assets/javascripts/application.js
|
153
|
+
- test/dummy/app/controllers/application_controller.rb
|
154
|
+
- test/dummy/app/controllers/anis_controller.rb
|
155
|
+
- test/dummy/app/views/anis/_form.html.erb
|
156
|
+
- test/dummy/app/views/anis/edit.html.erb
|
157
|
+
- test/dummy/app/views/anis/index.html.erb
|
158
|
+
- test/dummy/app/views/anis/show.html.erb
|
159
|
+
- test/dummy/app/views/anis/new.html.erb
|
160
|
+
- test/dummy/app/views/layouts/application.html.erb
|
161
|
+
- test/dummy/config/routes.rb
|
162
|
+
- test/dummy/config/environments/test.rb
|
163
|
+
- test/dummy/config/environments/production.rb
|
164
|
+
- test/dummy/config/environments/development.rb
|
165
|
+
- test/dummy/config/boot.rb
|
166
|
+
- test/dummy/config/database.yml
|
167
|
+
- test/dummy/config/application.rb
|
168
|
+
- test/dummy/config/initializers/secret_token.rb
|
169
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
170
|
+
- test/dummy/config/initializers/inflections.rb
|
171
|
+
- test/dummy/config/initializers/mime_types.rb
|
172
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
173
|
+
- test/dummy/config/initializers/session_store.rb
|
174
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
175
|
+
- test/dummy/config/environment.rb
|
176
|
+
- test/dummy/config/locales/en.yml
|
177
|
+
- test/dummy/log/development.log
|
178
|
+
- test/dummy/log/test.log
|
179
|
+
- test/dummy/public/422.html
|
180
|
+
- test/dummy/public/404.html
|
181
|
+
- test/dummy/public/500.html
|
182
|
+
- test/dummy/public/favicon.ico
|
183
|
+
- test/dummy/Rakefile
|
184
|
+
- test/dummy/README.rdoc
|
185
|
+
- test/dummy/db/migrate/20130714091905_create_anis.rb
|
186
|
+
- test/dummy/db/development.sqlite3
|
187
|
+
- test/dummy/db/schema.rb
|
188
|
+
- test/dummy/db/test.sqlite3
|
189
|
+
- test/ji_ying_test.rb
|