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
|
||||
require '../lib/pastebinner'
|
||||
require '../lib/option_parser'
|
||||
require 'pry'
|
||||
|
||||
# setup our object and grab a session key
|
||||
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)
|
||||
data_dir = "../data/"
|
||||
filename = "pastebin_paste_key"
|
||||
binding.pry
|
||||
keys.map do |id|
|
||||
if File.exist?(data_dir + filename + "_#{id[:key]}")
|
||||
puts "#{id[:key]} already exists on your filesystem, skipping..."
|
||||
if File.exist?(data_dir + filename + "_#{id}")
|
||||
puts "#{id} already exists on your filesystem, skipping..."
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue