fixed an issue that was occurring with downloading the raw pastes
This commit is contained in:
parent
fc82bd78d1
commit
9a4f1251dd
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require '../lib/pastebinner'
|
require '../lib/pastebinner'
|
||||||
require '../lib/option_parser'
|
require '../lib/option_parser'
|
||||||
|
require 'pry'
|
||||||
|
|
||||||
# setup our object and grab a session key
|
# setup our object and grab a session key
|
||||||
pb = Pastebinner.new(ENV['pastebin_api_key'], ENV['pastebin_username'], ENV['pastebin_password'])
|
pb = Pastebinner.new(ENV['pastebin_api_key'], ENV['pastebin_username'], ENV['pastebin_password'])
|
||||||
|
@ -12,11 +13,12 @@ def download_pastes(pb)
|
||||||
keys = pb.get_unique_paste_keys(pub_pastes)
|
keys = pb.get_unique_paste_keys(pub_pastes)
|
||||||
data_dir = "../data/"
|
data_dir = "../data/"
|
||||||
filename = "pastebin_paste_key"
|
filename = "pastebin_paste_key"
|
||||||
|
binding.pry
|
||||||
keys.map do |id|
|
keys.map do |id|
|
||||||
if File.exist?(data_dir + filename + "_#{id[:key]}")
|
if File.exist?(data_dir + filename + "_#{id}")
|
||||||
puts "#{id[:key]} already exists on your filesystem, skipping..."
|
puts "#{id} already exists on your filesystem, skipping..."
|
||||||
else
|
else
|
||||||
File.write(data_dir + filename + "_#{id[:key]}", pb.raw_paste_data(id[:key]))
|
File.write(data_dir + filename + "_#{id}", pb.raw_paste_data(id))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue