fourchan-kit 0.1.0
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 +22 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +99 -0
- data/Rakefile +7 -0
- data/bin/fourchan +4 -0
- data/features/cassettes/Fourchan/I_want_to_download_a_thread.yml +1668 -0
- data/features/fourchan.feature +24 -0
- data/features/step_definitions/cli_steps.rb +11 -0
- data/features/support/env.rb +39 -0
- data/fourchan-kit.gemspec +32 -0
- data/lib/fourchan/kit.rb +34 -0
- data/lib/fourchan/kit/api.rb +62 -0
- data/lib/fourchan/kit/board.rb +74 -0
- data/lib/fourchan/kit/cli.rb +37 -0
- data/lib/fourchan/kit/post.rb +24 -0
- data/lib/fourchan/kit/thread.rb +58 -0
- data/lib/fourchan/kit/tools.rb +158 -0
- data/lib/fourchan/kit/version.rb +5 -0
- data/spec/cassettes/Fourchan_Kit/should_be_able_to_get_an_array_of_board_names.yml +69 -0
- data/spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_info_for_all_boards.yml +69 -0
- data/spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_the_catalog_for_a_board.yml +2427 -0
- data/spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_the_posts_from_a_thread.yml +68 -0
- data/spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_the_threads_for_a_board.yml +46 -0
- data/spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_threads_from_a_page.yml +274 -0
- data/spec/cassettes/Fourchan_Kit_Board/and_a_total_of_7685_posts.yml +31381 -0
- data/spec/cassettes/Fourchan_Kit_Board/and_have_15_threads_per_page.yml +2464 -0
- data/spec/cassettes/Fourchan_Kit_Board/and_should_have_a_total_of_150_threads.yml +2464 -0
- data/spec/cassettes/Fourchan_Kit_Board/should_have_10_pages.yml +2530 -0
- data/spec/cassettes/Fourchan_Kit_Board/should_have_908_posts_on_the_first_page.yml +6038 -0
- data/spec/cassettes/Fourchan_Kit_Thread/and_return_nothing_if_poster_didn_t_submit_one.yml +68 -0
- data/spec/cassettes/Fourchan_Kit_Thread/should_have_posts.yml +68 -0
- data/spec/cassettes/Fourchan_Kit_Thread/should_have_replies.yml +68 -0
- data/spec/cassettes/Fourchan_Kit_Thread/should_have_some_images.yml +68 -0
- data/spec/cassettes/Fourchan_Kit_Thread/when_using_op/should_have_a_name.yml +68 -0
- data/spec/cassettes/Fourchan_Kit_Thread/when_using_op/with_a_link_to_the_image.yml +68 -0
- data/spec/cassettes/Fourchan_Kit_Tools/should_download_a_list_of_threads.yml +1942 -0
- data/spec/cassettes/Fourchan_Kit_Tools/should_download_an_image.yml +599 -0
- data/spec/cassettes/Fourchan_Kit_Tools/should_download_images_from_a_thread.yml +823 -0
- data/spec/cassettes/Fourchan_Kit_Tools/should_verify_it_s_not_a_dead_thread.yml +54 -0
- data/spec/cassettes/Fourchan_Kit_Tools/when_it_is_dead/should_handle_that.yml +108 -0
- data/spec/fourchan_kit_api_spec.rb +35 -0
- data/spec/fourchan_kit_board_spec.rb +28 -0
- data/spec/fourchan_kit_spec.rb +10 -0
- data/spec/fourchan_kit_thread_spec.rb +33 -0
- data/spec/fourchan_kit_tools_spec.rb +59 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/threads.txt +2 -0
- metadata +270 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://boards.4chan.org/g/thread/41706090
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip,deflate,identity
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Mechanize/2.7.3 Ruby/2.1.1p76 (http://github.com/sparklemotion/mechanize/)
|
16
|
+
Accept-Charset:
|
17
|
+
- ISO-8859-1,utf-8;q=0.7,*;q=0.7
|
18
|
+
Accept-Language:
|
19
|
+
- en-us,en;q=0.5
|
20
|
+
Cookie:
|
21
|
+
- __cfduid=de014ce34d66bd40cf1a3f4030a4f08471399058141422
|
22
|
+
Host:
|
23
|
+
- boards.4chan.org
|
24
|
+
If-Modified-Since:
|
25
|
+
- Fri, 02 May 2014 18:05:04 GMT
|
26
|
+
Connection:
|
27
|
+
- keep-alive
|
28
|
+
Keep-Alive:
|
29
|
+
- 300
|
30
|
+
response:
|
31
|
+
status:
|
32
|
+
code: 304
|
33
|
+
message: Not Modified
|
34
|
+
headers:
|
35
|
+
Server:
|
36
|
+
- cloudflare-nginx
|
37
|
+
Date:
|
38
|
+
- Fri, 02 May 2014 19:15:43 GMT
|
39
|
+
Connection:
|
40
|
+
- keep-alive
|
41
|
+
Last-Modified:
|
42
|
+
- Fri, 02 May 2014 18:05:04 GMT
|
43
|
+
Etag:
|
44
|
+
- '"5363de50-15e7"'
|
45
|
+
Cache-Control:
|
46
|
+
- public, must-revalidate, proxy-revalidate
|
47
|
+
Cf-Ray:
|
48
|
+
- 12468c95095005b5-ARN
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: ''
|
52
|
+
http_version:
|
53
|
+
recorded_at: Fri, 02 May 2014 19:15:43 GMT
|
54
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,108 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://boards.4chan.org/g/thread/1337
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip,deflate,identity
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Mechanize/2.7.3 Ruby/2.1.1p76 (http://github.com/sparklemotion/mechanize/)
|
16
|
+
Accept-Charset:
|
17
|
+
- ISO-8859-1,utf-8;q=0.7,*;q=0.7
|
18
|
+
Accept-Language:
|
19
|
+
- en-us,en;q=0.5
|
20
|
+
Cookie:
|
21
|
+
- __cfduid=de014ce34d66bd40cf1a3f4030a4f08471399058141422
|
22
|
+
Host:
|
23
|
+
- boards.4chan.org
|
24
|
+
Connection:
|
25
|
+
- keep-alive
|
26
|
+
Keep-Alive:
|
27
|
+
- 300
|
28
|
+
response:
|
29
|
+
status:
|
30
|
+
code: 404
|
31
|
+
message: Not Found
|
32
|
+
headers:
|
33
|
+
Server:
|
34
|
+
- cloudflare-nginx
|
35
|
+
Date:
|
36
|
+
- Fri, 02 May 2014 19:15:43 GMT
|
37
|
+
Content-Type:
|
38
|
+
- text/html; charset=utf-8
|
39
|
+
Transfer-Encoding:
|
40
|
+
- chunked
|
41
|
+
Connection:
|
42
|
+
- keep-alive
|
43
|
+
Vary:
|
44
|
+
- Accept-Encoding
|
45
|
+
Cache-Control:
|
46
|
+
- public, must-revalidate, proxy-revalidate
|
47
|
+
Cf-Ray:
|
48
|
+
- 12468c96943f05b5-ARN
|
49
|
+
Content-Encoding:
|
50
|
+
- gzip
|
51
|
+
body:
|
52
|
+
encoding: ASCII-8BIT
|
53
|
+
string: !binary |-
|
54
|
+
H4sIAAAAAAAAA6yZbVMbORKAP0NV/oN28sGmsGfswO0uxuYqmJdQBYEC7+VS
|
55
|
+
wG3JGnlGsUaalTQ2DvDfrzVjg4aQK0q3oYI1svSou9XT3RL9Xw7Oh6OvF4co
|
56
|
+
NRlHF3/sn54MUdCOoi9bwyg6GB2gf38anZ2ibthBV0YxYqLo8HPwbh3BvyA1
|
57
|
+
Ju9F0Xw+D+dboVRJNLqM7iyqa+cum21dTgxjEwd76/1ypbuMCz14BdDd2dmp
|
58
|
+
5pVjKY7hI6MGIzu2Tf8q2GwQDKUwVJj2aJHTAJHqaRAYemciO3cXkRQrTc2g
|
59
|
+
MJP270G0ggic0UEwpYu5VLF2prIMJ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KUlqqvAxuoM0nITZRIwr29gGKjEQ/
|
91
|
+
fIXaqOoqnc129SO8d9twF9bUfDTgNePC0GaDcKx1o4Ua5V1uY2Ol+dpYUTyt
|
92
|
+
5j3a3/YX/H+03y/dUAousfWF8roVxvaj6i52bx2tLmv3/gsAAP//dFlPb5sw
|
93
|
+
FL9P2newfBgwGQjpVk1jIKWbtO3SXrZTlIPBjuMKYmYnaWmT775nA4Fm3QHM
|
94
|
+
e37P9vtj8+D39o1cI//sH6ZqKrdgPeOPd2vfG355e4F1cJg45yLkD79yfUkM
|
95
|
+
UUQQTSipg2e59L4rJSq+gBdkC1WeuSvuobzzVplO5VKvMns7Hs/6wbNvOdGf
|
96
|
+
rGuOx+UqiJq92fhUC7coE5yI66yy5P2WP6BvFFwTpDQzUQlu2PE+pL4KSA3M
|
97
|
+
Mcjmpv1FxS2cp9C3nK1SGlHTbsssgSejy0ykddRQWxncKsbBbsP17oZDZnLf
|
98
|
+
GnQK/M6bZHAR8TrPecTrACnh7A3pYHBUqjoeqXsInyeoCx1C9hIU4urWDT2/
|
99
|
+
F2Fyff3x6lOYAAX1ouolrRTkgo09HGzbtpZP/GcD5E7v+VRky0DRnkkHyR+c
|
100
|
+
8uki1HEPjxWKtdAweUCSZRgswhNyw6ZUpYRyyFqST5Lf2jtmPkYujzP8A8pb
|
101
|
+
3GFINqFhwgRUYxhrbIaBi/M0LreBoR5D+BjiGrZMEwL1Sr/bjf/yC+qYm3l+
|
102
|
+
gVsB58XEo0oPolg1WQtkc8Chi+ZzHJt2uq87kMeBRDEMH2vJombTYESrXYZf
|
103
|
+
TIjj/Euhp0aOxwrOLxzxajMort3KCj2suKw41WGxFw5aGqTOWBLOvw6P6J3l
|
104
|
+
pmg+m12F81nyoftSiNCiqpCTMEhzSO8DZ9F/1tIniING878AAAD//+ICAAAA
|
105
|
+
//8DABYxWQ/1HQAA
|
106
|
+
http_version:
|
107
|
+
recorded_at: Fri, 02 May 2014 19:15:43 GMT
|
108
|
+
recorded_with: VCR 2.9.0
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fourchan::Kit::API, :vcr do
|
4
|
+
it 'should be able to get info for all boards' do
|
5
|
+
boards = Fourchan::Kit::API.get_boards
|
6
|
+
boards.length.should == 63
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should be able to get the catalog for a board' do
|
10
|
+
catalog = Fourchan::Kit::API.get_catalog 'g'
|
11
|
+
catalog.length.should == 10
|
12
|
+
catalog.first['page'].should == 1
|
13
|
+
catalog.first['threads'].first['no'] == 39894014
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should be able to get the threads for a board' do
|
17
|
+
threads = Fourchan::Kit::API.get_threads 'g'
|
18
|
+
threads.length.should == 10
|
19
|
+
threads.first['page'].should == 1
|
20
|
+
threads.first['threads'].first['no'].should == 39894014
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should be able to get the posts from a thread' do
|
24
|
+
posts = Fourchan::Kit::API.get_thread 'g', 41706090
|
25
|
+
posts.length.should == 6
|
26
|
+
posts.first['no'].should == 41706090
|
27
|
+
posts.last['no'].should == 41706626
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should be able to get threads from a page' do
|
31
|
+
posts = Fourchan::Kit::API.get_page 'g', 1
|
32
|
+
posts.length.should == 15
|
33
|
+
posts.first['posts'].first['no'].should == 39894014
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fourchan::Kit::Board, :vcr do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@board = Fourchan::Kit::Board.new 'g'
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should have 10 pages' do
|
10
|
+
@board.board.length.should == 10
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'and have 15 threads per page' do
|
14
|
+
@board.threads(1).length.should == 15
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'and should have a total of 150 threads' do
|
18
|
+
@board.all_threads.length.should == 150
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should have 908 posts on the first page' do
|
22
|
+
@board.posts.length.should == 908
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'and a total of 7685 posts' do
|
26
|
+
@board.all_posts.length.should == 7685
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fourchan::Kit::Thread, :vcr do
|
4
|
+
before(:each) do
|
5
|
+
@thread = Fourchan::Kit::Thread.new 'g', 41706090
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should have posts' do
|
9
|
+
@thread.posts.length.should == 6
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should have replies' do
|
13
|
+
@thread.replies.length.should == 5
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should have some images' do
|
17
|
+
@thread.images.length.should == 2
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'and return nothing if poster didn\'t submit one' do
|
21
|
+
@thread.posts.last.image_link.should == nil
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when using #op' do
|
25
|
+
it 'should have a name' do
|
26
|
+
@thread.op.name.should == 'Anonymous'
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'with a link to the image' do
|
30
|
+
@thread.op.image_link.should == 'http://i.4cdn.org/g/1399051774807.jpg'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Fourchan::Kit::Tools, :vcr do
|
4
|
+
it 'should download an image' do
|
5
|
+
Fourchan::Kit::Tools.download_image 'http://i.4cdn.org/g/1399051774807.jpg'
|
6
|
+
File.exists?('images').should == true
|
7
|
+
File.exists?('images/1399051774807.jpg').should == true
|
8
|
+
FileUtils.rm_rf('images')
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should download images from a thread' do
|
12
|
+
Fourchan::Kit::Tools.download_thread 'http://boards.4chan.org/g/thread/41706090'
|
13
|
+
File.exists?('images').should == true
|
14
|
+
Dir['images/*'].should have(2).items
|
15
|
+
Dir['images/*'].should == ["images/1399051774807.jpg", "images/1399052297446.jpg"]
|
16
|
+
FileUtils.rm_rf('images')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should download a list of threads' do
|
20
|
+
Fourchan::Kit::Tools.download_threads 'spec/threads.txt'
|
21
|
+
File.exists?('images').should == true
|
22
|
+
Dir['images/*'].should have(2).items # 2 folders
|
23
|
+
Dir['images/**/*'].should have(6).items # 4 images and 2 folders
|
24
|
+
FileUtils.rm_rf('images')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should lurk'
|
28
|
+
|
29
|
+
it 'should create a directory' do
|
30
|
+
Fourchan::Kit::Tools.create_dir 'some_test/directory'
|
31
|
+
File.exists?('some_test/directory').should == true
|
32
|
+
FileUtils.rm_rf('some_test')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should get board and thread from a link' do
|
36
|
+
board, thread = Fourchan::Kit::Tools.get_info 'http://boards.4chan.org/g/thread/41706090'
|
37
|
+
board.should == 'g'
|
38
|
+
thread.should == 41706090
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should verify it\'s a thread' do
|
42
|
+
valid = Fourchan::Kit::Tools.valid_thread? 'http://boards.4chan.org/g/thread/41706090'
|
43
|
+
valid.should == true
|
44
|
+
invalid = Fourchan::Kit::Tools.valid_thread? 'http://boards.4chan.org/g/res/41706090'
|
45
|
+
invalid.should == false
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should verify it\'s not a dead thread' do
|
49
|
+
alive = Fourchan::Kit::Tools.valid_link? 'http://boards.4chan.org/g/thread/41706090'
|
50
|
+
alive.should == true
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when it is dead' do
|
54
|
+
it 'should handle that' do
|
55
|
+
dead = Fourchan::Kit::Tools.valid_link? 'http://boards.4chan.org/g/thread/1337'
|
56
|
+
dead.should == false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'fourchan/kit'
|
3
|
+
require 'vcr'
|
4
|
+
|
5
|
+
VCR.configure do |c|
|
6
|
+
c.cassette_library_dir = 'spec/cassettes'
|
7
|
+
c.hook_into :webmock
|
8
|
+
c.configure_rspec_metadata!
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.configure do |c|
|
12
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
13
|
+
|
14
|
+
c.before do # Globally quiet puts for tests
|
15
|
+
IO.any_instance.stub(:puts)
|
16
|
+
end
|
17
|
+
end
|
data/spec/threads.txt
ADDED
metadata
ADDED
@@ -0,0 +1,270 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fourchan-kit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- lauritzsh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :runtime
|
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: mechanize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.7'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.19'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.19'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aruba
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.5'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.6'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.6'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: cucumber
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.3'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.3'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.14'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.14'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: vcr
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.9'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.9'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: webmock
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.17'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.17'
|
153
|
+
description: Fourchan Kit is a Ruby wrapper and tool for the 4chan API. Use Fourchan
|
154
|
+
Kit to interact with the API using Ruby, or use the tool to interact with the threads
|
155
|
+
on 4chan.
|
156
|
+
email:
|
157
|
+
- mail@lauritz.me
|
158
|
+
executables:
|
159
|
+
- fourchan
|
160
|
+
extensions: []
|
161
|
+
extra_rdoc_files: []
|
162
|
+
files:
|
163
|
+
- ".gitignore"
|
164
|
+
- ".rspec"
|
165
|
+
- ".travis.yml"
|
166
|
+
- Gemfile
|
167
|
+
- LICENSE.txt
|
168
|
+
- README.md
|
169
|
+
- Rakefile
|
170
|
+
- bin/fourchan
|
171
|
+
- features/cassettes/Fourchan/I_want_to_download_a_thread.yml
|
172
|
+
- features/fourchan.feature
|
173
|
+
- features/step_definitions/cli_steps.rb
|
174
|
+
- features/support/env.rb
|
175
|
+
- fourchan-kit.gemspec
|
176
|
+
- lib/fourchan/kit.rb
|
177
|
+
- lib/fourchan/kit/api.rb
|
178
|
+
- lib/fourchan/kit/board.rb
|
179
|
+
- lib/fourchan/kit/cli.rb
|
180
|
+
- lib/fourchan/kit/post.rb
|
181
|
+
- lib/fourchan/kit/thread.rb
|
182
|
+
- lib/fourchan/kit/tools.rb
|
183
|
+
- lib/fourchan/kit/version.rb
|
184
|
+
- spec/cassettes/Fourchan_Kit/should_be_able_to_get_an_array_of_board_names.yml
|
185
|
+
- spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_info_for_all_boards.yml
|
186
|
+
- spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_the_catalog_for_a_board.yml
|
187
|
+
- spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_the_posts_from_a_thread.yml
|
188
|
+
- spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_the_threads_for_a_board.yml
|
189
|
+
- spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_threads_from_a_page.yml
|
190
|
+
- spec/cassettes/Fourchan_Kit_Board/and_a_total_of_7685_posts.yml
|
191
|
+
- spec/cassettes/Fourchan_Kit_Board/and_have_15_threads_per_page.yml
|
192
|
+
- spec/cassettes/Fourchan_Kit_Board/and_should_have_a_total_of_150_threads.yml
|
193
|
+
- spec/cassettes/Fourchan_Kit_Board/should_have_10_pages.yml
|
194
|
+
- spec/cassettes/Fourchan_Kit_Board/should_have_908_posts_on_the_first_page.yml
|
195
|
+
- spec/cassettes/Fourchan_Kit_Thread/and_return_nothing_if_poster_didn_t_submit_one.yml
|
196
|
+
- spec/cassettes/Fourchan_Kit_Thread/should_have_posts.yml
|
197
|
+
- spec/cassettes/Fourchan_Kit_Thread/should_have_replies.yml
|
198
|
+
- spec/cassettes/Fourchan_Kit_Thread/should_have_some_images.yml
|
199
|
+
- spec/cassettes/Fourchan_Kit_Thread/when_using_op/should_have_a_name.yml
|
200
|
+
- spec/cassettes/Fourchan_Kit_Thread/when_using_op/with_a_link_to_the_image.yml
|
201
|
+
- spec/cassettes/Fourchan_Kit_Tools/should_download_a_list_of_threads.yml
|
202
|
+
- spec/cassettes/Fourchan_Kit_Tools/should_download_an_image.yml
|
203
|
+
- spec/cassettes/Fourchan_Kit_Tools/should_download_images_from_a_thread.yml
|
204
|
+
- spec/cassettes/Fourchan_Kit_Tools/should_verify_it_s_not_a_dead_thread.yml
|
205
|
+
- spec/cassettes/Fourchan_Kit_Tools/when_it_is_dead/should_handle_that.yml
|
206
|
+
- spec/fourchan_kit_api_spec.rb
|
207
|
+
- spec/fourchan_kit_board_spec.rb
|
208
|
+
- spec/fourchan_kit_spec.rb
|
209
|
+
- spec/fourchan_kit_thread_spec.rb
|
210
|
+
- spec/fourchan_kit_tools_spec.rb
|
211
|
+
- spec/spec_helper.rb
|
212
|
+
- spec/threads.txt
|
213
|
+
homepage: http://rubygems.org/gems/fourchan-kit
|
214
|
+
licenses:
|
215
|
+
- MIT
|
216
|
+
metadata: {}
|
217
|
+
post_install_message:
|
218
|
+
rdoc_options: []
|
219
|
+
require_paths:
|
220
|
+
- lib
|
221
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - ">="
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '0'
|
226
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
|
+
requirements:
|
228
|
+
- - ">="
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: '0'
|
231
|
+
requirements: []
|
232
|
+
rubyforge_project:
|
233
|
+
rubygems_version: 2.2.2
|
234
|
+
signing_key:
|
235
|
+
specification_version: 4
|
236
|
+
summary: A tool and API wrapper for the 4chan API.
|
237
|
+
test_files:
|
238
|
+
- features/cassettes/Fourchan/I_want_to_download_a_thread.yml
|
239
|
+
- features/fourchan.feature
|
240
|
+
- features/step_definitions/cli_steps.rb
|
241
|
+
- features/support/env.rb
|
242
|
+
- spec/cassettes/Fourchan_Kit/should_be_able_to_get_an_array_of_board_names.yml
|
243
|
+
- spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_info_for_all_boards.yml
|
244
|
+
- spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_the_catalog_for_a_board.yml
|
245
|
+
- spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_the_posts_from_a_thread.yml
|
246
|
+
- spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_the_threads_for_a_board.yml
|
247
|
+
- spec/cassettes/Fourchan_Kit_API/should_be_able_to_get_threads_from_a_page.yml
|
248
|
+
- spec/cassettes/Fourchan_Kit_Board/and_a_total_of_7685_posts.yml
|
249
|
+
- spec/cassettes/Fourchan_Kit_Board/and_have_15_threads_per_page.yml
|
250
|
+
- spec/cassettes/Fourchan_Kit_Board/and_should_have_a_total_of_150_threads.yml
|
251
|
+
- spec/cassettes/Fourchan_Kit_Board/should_have_10_pages.yml
|
252
|
+
- spec/cassettes/Fourchan_Kit_Board/should_have_908_posts_on_the_first_page.yml
|
253
|
+
- spec/cassettes/Fourchan_Kit_Thread/and_return_nothing_if_poster_didn_t_submit_one.yml
|
254
|
+
- spec/cassettes/Fourchan_Kit_Thread/should_have_posts.yml
|
255
|
+
- spec/cassettes/Fourchan_Kit_Thread/should_have_replies.yml
|
256
|
+
- spec/cassettes/Fourchan_Kit_Thread/should_have_some_images.yml
|
257
|
+
- spec/cassettes/Fourchan_Kit_Thread/when_using_op/should_have_a_name.yml
|
258
|
+
- spec/cassettes/Fourchan_Kit_Thread/when_using_op/with_a_link_to_the_image.yml
|
259
|
+
- spec/cassettes/Fourchan_Kit_Tools/should_download_a_list_of_threads.yml
|
260
|
+
- spec/cassettes/Fourchan_Kit_Tools/should_download_an_image.yml
|
261
|
+
- spec/cassettes/Fourchan_Kit_Tools/should_download_images_from_a_thread.yml
|
262
|
+
- spec/cassettes/Fourchan_Kit_Tools/should_verify_it_s_not_a_dead_thread.yml
|
263
|
+
- spec/cassettes/Fourchan_Kit_Tools/when_it_is_dead/should_handle_that.yml
|
264
|
+
- spec/fourchan_kit_api_spec.rb
|
265
|
+
- spec/fourchan_kit_board_spec.rb
|
266
|
+
- spec/fourchan_kit_spec.rb
|
267
|
+
- spec/fourchan_kit_thread_spec.rb
|
268
|
+
- spec/fourchan_kit_tools_spec.rb
|
269
|
+
- spec/spec_helper.rb
|
270
|
+
- spec/threads.txt
|