cablegator 0.9.9 → 1.0.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.
- data/bin/download_cables +2 -2
- data/lib/cablegator/version.rb +1 -1
- data/lib/cablegator/wikileaks.rb +5 -9
- metadata +3 -3
data/bin/download_cables
CHANGED
@@ -5,9 +5,9 @@ require 'fileutils'
|
|
5
5
|
dir_prefix = ARGV[0] || Dir.pwd
|
6
6
|
|
7
7
|
puts "Downloading cables to #{File.expand_path(dir_prefix)}"
|
8
|
-
|
8
|
+
WikiLeaks.with_each_cable do |cable_url|
|
9
9
|
file_location = File.expand_path(dir_prefix + cable_url)
|
10
|
-
reference_id =
|
10
|
+
reference_id = WikiLeaks.reference_id(cable_url)
|
11
11
|
|
12
12
|
if !File.exist?(file_location)
|
13
13
|
FileUtils.mkdir_p(File.dirname(file_location))
|
data/lib/cablegator/version.rb
CHANGED
data/lib/cablegator/wikileaks.rb
CHANGED
@@ -26,15 +26,11 @@ class WikiLeaks
|
|
26
26
|
def with_each_cable
|
27
27
|
doc = Nokogiri::HTML(self.get(HOME))
|
28
28
|
doc.css(%{a[href^='/date']}).each do |link|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
yield cable_url
|
35
|
-
end
|
36
|
-
rescue
|
37
|
-
STDOUT.puts "error GETtin page #{cable_url}"
|
29
|
+
cable_url = link.attributes['href'].value
|
30
|
+
page_with_cables = Nokogiri::HTML(WikiLeaks.get(cable_url))
|
31
|
+
page_with_cables.css(%{a[href^='/cable']}).each do |cable|
|
32
|
+
cable_url = cable.attributes['href'].value
|
33
|
+
yield cable_url
|
38
34
|
end
|
39
35
|
end
|
40
36
|
end
|