Gplus script version 1.1

In previous post, when I run gplus script it will display

the stream from circle we mentioned in command

eg. ruby gplus.rb username password circle_name

In this version , It will prompt for username and password .. and it displays all circle names of

current user .. and we can see streams of any circle shown 🙂



ruby, rubygems, mechanize(gem),  highline (gem for secure password)

Ruby code

Program name: Gplus script
Date Written: 16/08/2011
Date Modified: 17/08/2011
Author : Sathianarayanan.S
License: GPL2.0
Version: 1.1
require 'rubygems'
require 'mechanize'
require "highline/import"

print "Enter your username: "
username = gets.chomp
password = ask("Enter the password :" ) { |p| p.echo = "*" }
password = password.chomp

agent =
agent.user_agent_alias = 'Mac Safari'
page = agent.get("")
puts 'Logggig....'
puts "=========================================================================\n"
form = page.forms.first
form.Email = username
form.Passwd = password

page = agent.submit form
circles ='#content .c-j.a-nb-j.a-nb-Jh-j')

puts 'Streams:'
i = 1
circles.each do |circle|
  puts i.to_s+') '+circle
puts "=========================================================================\n"
while true
 print "Enter circle: "
 circle_name = gets.chomp

 page = => circle_name).click

 streams ='#contentPane')
 i = 1
 streams.each do |stream|
   if stream.text != ''
     puts i.to_s+') ''').text+' shared:'
     puts  i.to_s+') '+'Video/photos...'
   puts ''
 puts "=========================================================================\n"

rescue SocketError
 puts 'Error in internet connection'
rescue NoMethodError
  puts 'Invalid username or password or circle'
rescue Interrupt
  puts "\n========================================================================="
  puts "\nQuiting...."

About sathia

Web developer at cloudmint
This entry was posted in programs and tagged , , , , , , , , , , , , , , , , . Bookmark the permalink.

3 Responses to Gplus script version 1.1

  1. Angelique says:

    Pretty insightful. Thanks!

    My blog:
    DSL Anbieter

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s