回答編集履歴
2
修正
test
CHANGED
@@ -1,50 +1,48 @@
|
|
1
1
|
```Ruby
|
2
2
|
|
3
|
-
#encoding : utf-8
|
3
|
+
# encoding : utf-8
|
4
|
-
|
5
|
-
require"open-uri"
|
6
|
-
|
7
|
-
require"certified"
|
8
4
|
|
9
5
|
|
10
6
|
|
7
|
+
require'open-uri'
|
8
|
+
|
9
|
+
require'certified'
|
10
|
+
|
11
|
+
|
12
|
+
|
11
|
-
base_url =
|
13
|
+
base_url = 'https://job.rikunabi.com/2018/search/seminar/result/?ms=1&moduleCd=2&isc=ps055&pn='
|
12
14
|
|
13
15
|
count = 1
|
14
16
|
|
15
17
|
|
16
18
|
|
17
|
-
loop
|
19
|
+
loop do
|
18
20
|
|
19
|
-
page_source = open(base_url + count.to_s, &:read)
|
21
|
+
page_source = open(base_url + count.to_s, &:read)
|
20
22
|
|
21
|
-
link = page_source.scan(
|
23
|
+
link = page_source.scan(/<a href="(.+?)" target="_blank">/).flatten
|
22
24
|
|
23
|
-
link = link.select{|e| e.include?(
|
25
|
+
link = link.select{ |e| e.include?('/2018/company/r') }
|
24
26
|
|
25
27
|
|
26
28
|
|
27
|
-
|
29
|
+
link.none? && break
|
28
|
-
|
29
|
-
break
|
30
|
-
|
31
|
-
end
|
32
30
|
|
33
31
|
|
34
32
|
|
35
|
-
link.each do |element|
|
33
|
+
link.each do |element|
|
36
34
|
|
37
|
-
data = open("https://job.rikunabi.com#{element}", &:read)
|
35
|
+
data = open("https://job.rikunabi.com#{element}", &:read)
|
38
36
|
|
39
|
-
puts data.scan(%r
|
37
|
+
puts data.scan(%r{<title>(.+?)の新卒採用・企業情報|リクナビ2018</title>})
|
40
38
|
|
41
|
-
end
|
39
|
+
end
|
42
40
|
|
43
41
|
|
44
42
|
|
45
|
-
count += 1
|
43
|
+
count += 1
|
46
44
|
|
47
|
-
|
45
|
+
end
|
48
46
|
|
49
47
|
```
|
50
48
|
|
1
修正
test
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
page_source = open(base_url + count.to_s, &:read)
|
20
20
|
|
21
|
-
link = page_source.scan(%r|<a href="(.+?)" target="_blank">|).flatten
|
21
|
+
link = page_source.scan(%r|<a href="(.+?)" target="_blank">|).flatten
|
22
22
|
|
23
23
|
link = link.select{|e| e.include?("/2018/company/r")}
|
24
24
|
|