Created
February 18, 2009 22:41
-
-
Save jystewart/66597 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/ruby | |
# | |
# Facebook allows you to specify an RSS feed to poll to get new 'notes' for personal | |
# profiles, but no similar mechanism to feed a feed in as a group's "news" (possibly | |
# because of the awful data model around groups...) | |
# | |
# This is a quick mechanize script to update the 'news' box for a group you are an | |
# admin of. It's very basic, but works, and could be developed with an RSS reader | |
# or as an activerecord callback to send a new blog entry/news story to facebook, or... | |
# | |
# Obviously feel free to do what you like with it, but if you do use or further develop | |
# it, please let me know. | |
# | |
# James Stewart - [email protected] - http://jystewart.net/process/ | |
require 'rubygems' | |
require 'mechanize' | |
require 'logger' | |
group_id = 31757944403 | |
agent = WWW::Mechanize.new { |a| a.log = Logger.new("mech.log") } | |
agent.user_agent = 'Street Action Facebook Populator' | |
page = agent.get("http://www.facebook.com/") | |
login_form = page.form_with(:name => "menubar_login") | |
login_form.field_with(:name => "email").value = "#EMAIL" | |
login_form.field_with(:name => "pass").value = "#PASSWORD" | |
logged_in_page = agent.submit(login_form) | |
edit_group_page = agent.get("http://www.facebook.com/groups/edit.php?gid=#{group_id}") | |
edit_form = edit_group_page.form_with(:name => 'group_info_form') | |
edit_form.field_with(:name => 'sec_blurb').value = 'Testing automatic news updates' | |
submitted = agent.submit(edit_form) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment