class InstagramCrawler::Parser::Base
Private Instance Methods
check_after_time(time)
click to toggle source
# File lib/instagram_crawler/parser/base.rb, line 25 def check_after_time(time) if Config.after_date && (Config.parse_after_date > time) Logger.info "\nSuccess, the files after #{Config.after_date} have been downloaded!".light_green exit end end
output(time, url)
click to toggle source
# File lib/instagram_crawler/parser/base.rb, line 17 def output(time, url) Logger.info "[#{time}]".light_cyan + " #{url}" end
parse_post(posts, time)
click to toggle source
# File lib/instagram_crawler/parser/base.rb, line 6 def parse_post(posts, time) posts.each.with_index(1) do |post, index| url = post["node"]["is_video"] ? post["node"]["video_url"] : post["node"]["display_url"] output(time, url) File.download(url, "post/#{time}", "#{index}.#{time}") end end
parse_to_date(ts)
click to toggle source
# File lib/instagram_crawler/parser/base.rb, line 21 def parse_to_date(ts) Time.at(ts).strftime('%Y-%m-%dT%H:%M') end