Sha256: ef2eab95c40d234b707ce63a29a6f10c89aa4d5260ed9dbc763f3095638ec412
Contents?: true
Size: 1.43 KB
Versions: 4
Compression:
Stored size: 1.43 KB
Contents
#!/usr/bin/env ruby require 'fb_scrape' require 'thor' require 'json' class FBScrape::CLI < Thor desc "version", "Get the version of the client running" def version puts FBScrape::VERSION end desc "id", "Get the page_id for page" option :page_name, :required => true option :token, :required => true def id begin client = FBScrape::Client.new(options[:page_name], options[:token]) puts client.id rescue ArgumentError => e puts e.message end end desc "posts", "Get all the posts for the page" option :page_id, :required => true option :token, :required => true option :limit, :required => false def posts begin limit = options[:limit] || nil client = FBScrape::Client.new(nil, options[:token], options[:page_id]) client.load(limit) posts = client.posts puts JSON.pretty_generate(posts) rescue ArgumentError => e puts "Error:" + e.message end end desc "comments", "Get all the comments for a post's shortcode" option :id, :required => true option :token, :required => true option :page_id, :required => false def comments begin token = options[:token] id = options[:id] post = FBScrape::Post.load_from_id(id, token) post.load_all_comments comments = post.comments puts JSON.pretty_generate(comments) rescue ArgumentError => e puts e.message end end end FBScrape::CLI.start(ARGV)
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fb_scrape-0.0.8 | bin/fb_scrape |
fb_scrape-0.0.7 | bin/fb_scrape |
fb_scrape-0.0.6 | bin/fb_scrape |
fb_scrape-0.0.5 | bin/fb_scrape |