Created
January 31, 2013 20:27
-
-
Save lucasdupin/4686145 to your computer and use it in GitHub Desktop.
Daemon to change a facebook page's cover photo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'net/https' | |
require 'rubygems' | |
require 'daemons' | |
PIC_IDS = %w(404626466293247 404626476293246 404626472959913 404626492959911) #Pics to change | |
PAGE_TOKEN = 'TOKEN_HERE' | |
PAGE_ID = 'PAGE_ID_HERE' | |
uri = URI("https://graph.facebook.com/#{PAGE_ID}") | |
Daemons.run_proc('change_cover.rb') do | |
counter = 0 | |
loop do | |
https = Net::HTTP.new(uri.host,uri.port) | |
https.use_ssl = true | |
req = Net::HTTP::Post.new(uri.path) | |
req.set_form_data :cover => PIC_IDS[(counter % PIC_IDS.size)], :access_token => PAGE_TOKEN, :no_feed_story => true | |
res = https.request(req) | |
puts "Response: #{res.body}" | |
sleep 20 | |
counter += 1 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment