sjunkieex 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +0 -3
- data/lib/sjunkieex/interface.rb +12 -2
- data/lib/sjunkieex/version.rb +1 -1
- data/test/test_interface.rb +2 -2
- metadata +13 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b859672bb22dab37d676c3f8efa3ff4941d5a7de
|
4
|
+
data.tar.gz: 55720669ccf536b97a9db58bd85ec538a010c0ba
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 78e7e024960cf8f1d5cc71624fab7dd90a95d6e633ed565125abb95ea03caedbeb1f84ef8c9a4ab1916feabfbd93982cb3c832c91d484388514495c0cc1b8e60
|
7
|
+
data.tar.gz: 9b091db9d95cdff14b69502ab8853809562877d5a7c282dcb29ed8990350e54b893a361426fdb458a75b4b71615f26ddd57f2c5d63832b2b567e10fe443c1533
|
data/Gemfile
CHANGED
data/lib/sjunkieex/interface.rb
CHANGED
@@ -53,7 +53,7 @@ module Sjunkieex
|
|
53
53
|
# series_link - the link to the page
|
54
54
|
#
|
55
55
|
# Returns a hash indexed by series identifier
|
56
|
-
def parse_series_page(series_name, series_link)
|
56
|
+
def parse_series_page(series_name, series_link, recursive=true)
|
57
57
|
|
58
58
|
link_data = Hash.new
|
59
59
|
|
@@ -89,7 +89,17 @@ module Sjunkieex
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
|
92
|
+
# check if this page contains pagination (for example TBBT has more than
|
93
|
+
# 3 pages), so we have to parse all pages recursively
|
94
|
+
data_from_other_page = {}
|
95
|
+
|
96
|
+
if recursive && next_page = doc.css('a.next').first
|
97
|
+
data_from_other_page = parse_series_page(
|
98
|
+
series_name, next_page[:href], recursive)
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
return link_data.merge(data_from_other_page)
|
93
103
|
end
|
94
104
|
|
95
105
|
private
|
data/lib/sjunkieex/version.rb
CHANGED
data/test/test_interface.rb
CHANGED
@@ -89,11 +89,11 @@ class TestInterface < Test::Unit::TestCase
|
|
89
89
|
interface = Sjunkieex::Interface.new(@series_index)
|
90
90
|
filename = File.dirname(__FILE__) + '/site_dumps/the_big_bang_theory.html'
|
91
91
|
|
92
|
-
|
92
|
+
# false to turn of recursive handling
|
93
|
+
link_data = interface.parse_series_page("The Big Bang Theory", filename, false)
|
93
94
|
assert_instance_of Hash, link_data
|
94
95
|
|
95
96
|
assert_equal 1, link_data.length
|
96
|
-
|
97
97
|
assert_not_nil link_data["6_6"]
|
98
98
|
end
|
99
99
|
end
|
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sjunkieex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Philipp Böhm
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-05-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: nokogiri
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.5'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.5'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: hashconfig
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 0.0.1
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 0.0.1
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: sindex
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 0.1.5
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 0.1.5
|
62
55
|
description: Tool that extracts links from serienjunkies.org
|
@@ -90,27 +83,26 @@ files:
|
|
90
83
|
- test/test_interface.rb
|
91
84
|
homepage: ''
|
92
85
|
licenses: []
|
86
|
+
metadata: {}
|
93
87
|
post_install_message:
|
94
88
|
rdoc_options: []
|
95
89
|
require_paths:
|
96
90
|
- lib
|
97
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
92
|
requirements:
|
100
|
-
- -
|
93
|
+
- - '>='
|
101
94
|
- !ruby/object:Gem::Version
|
102
95
|
version: '0'
|
103
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
-
none: false
|
105
97
|
requirements:
|
106
|
-
- -
|
98
|
+
- - '>='
|
107
99
|
- !ruby/object:Gem::Version
|
108
100
|
version: '0'
|
109
101
|
requirements: []
|
110
102
|
rubyforge_project:
|
111
|
-
rubygems_version:
|
103
|
+
rubygems_version: 2.0.3
|
112
104
|
signing_key:
|
113
|
-
specification_version:
|
105
|
+
specification_version: 4
|
114
106
|
summary: serienjunkies.org link extractor
|
115
107
|
test_files:
|
116
108
|
- test/seriesindex_example.xml
|