encode_json method and a 1 character change in the filename check

This commit is contained in:
booboy 2018-11-10 04:31:32 -06:00
parent ef312d12cf
commit fa41c0cb7f
2 changed files with 6 additions and 1 deletions

View file

@ -13,7 +13,7 @@ def download_pastes(pb)
data_dir = "../data/" data_dir = "../data/"
filename = "pastebin_paste_key" filename = "pastebin_paste_key"
keys.map do |id| keys.map do |id|
if File.exist?(data_dir + filename + "_#{id[:keu]}") if File.exist?(data_dir + filename + "_#{id[:key]}")
puts "#{id[:key]} already exists on your filesystem, skipping..." puts "#{id[:key]} 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[:key]}", pb.raw_paste_data(id[:key]))

View file

@ -126,6 +126,11 @@ class Pastebinner
url: @scraping_api_url + ENDPOINTS[:scrape_item_meta] + "?i=#{unique_paste_key}") url: @scraping_api_url + ENDPOINTS[:scrape_item_meta] + "?i=#{unique_paste_key}")
end end
def encode_json(raw_paste_text)
# add in a method here that will add serialize the raw paste data in json, and add in two keys i think should be good enough to send off to a db?
# full_text: text, #paste_key_name: paste_key
end
# keep this method private so we are not letting anyone run any method in our program # keep this method private so we are not letting anyone run any method in our program
private private
# this will be the main way to execute any of these methods. this has the exception handling taken care of. # this will be the main way to execute any of these methods. this has the exception handling taken care of.