Git Product home page Git Product logo

contacts's Introduction

liangzan-contacts

liangzan-contacts is a fork of the contacts_19 gem. It aims to be compatible with 1.9 and above. It also provide interfaces to many European email providers.

Intro

Contacts is a universal interface to grab contact list information from various providers including Hotmail, AOL, Gmail, Plaxo, Yahoo, GMX.net, Web.de, inbox.it, sezname.cz.

Installation

$ gem install liangzan-contacts

or on the Gemfile

gem 'liangzan-contacts', '~>1.2.8', :require => 'contacts'

Background

For a long time, the only way to get a list of contacts from your free online email accounts was with proprietary PHP scripts that would cost you $50. The act of grabbing that list is a simple matter of screen scrapping and this library gives you all the functionality you need. Thanks to the generosity of the highly popular Rails website MOG (mog.com) for allowing this library to be released open-source to the world. It is easy to extend this library to add new free email providers, so please contact the author if you would like to help.

Usage

# returns [["name", "[email protected]"], ["another name", "[email protected]"]]
Contacts::Hotmail.new(login, password).contacts
Contacts::Yahoo.new(login, password).contacts
Contacts::Gmail.new(login, password).contacts

Contacts.new(:gmail, login, password).contacts
Contacts.new(:hotmail, login, password).contacts
Contacts.new(:yahoo, login, password).contacts

Contacts.guess(login, password).contacts

Notice there are three ways to use this library so that you can limit the use as much as you would like in your particular application. The Contacts.guess method will automatically concatenate all the address book contacts from each of the successful logins in the case that a username password works across multiple services.

Captcha error

If there are too many failed attempts with the gmail login info, Google will raise a captcha response. To integrate the captcha handling, pass in the token and response via:

Contacts::Gmail.new(login,
                    password,
                    :captcha_token => params[:captcha_token],
                    :captcha_response => params[:captcha_response]).contacts

Examples

See the examples/ directory.

Authors

Contributors

This library is released under the terms of the BSD.

contacts's People

Contributors

adamhunter avatar balepc avatar eofferma avatar eshear avatar gf3 avatar glennfu avatar ilyakatz avatar joeyaghion avatar laurynas avatar lazyatom avatar liangzan avatar onomojo avatar tonytargonski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

contacts's Issues

can handle captcha on yahoo?

Hi

I still got Contacts::AuthenticationError: Username and password do not match on my production server but not on my local server,

when I check on data and response I get this:
The code you entered is invalid. Please try again

and show recaptcha, could this gem handle captcha on yahoo login page?

thanks

error with json versions

[contacts]$ bundle
Fetching gem metadata from https://rubygems.org/........
Bundler could not find compatible versions for gem "json":
In Gemfile:
liangzan-contacts (> 1.2.8) ruby depends on
json (
> 1.6.5) ruby

rails (= 3.2.3) ruby depends on
  json (1.7.3)

GMX import not working any more, partially fixed

Since a couple days ago, GMX has redesigned most of its website and the redirects are not working any more. This is due to two reasons (both of which I have fixed locally):

  1. Mozilla Firefox 2.0 as user agent is not supported -> changing to Firefox 18 will work
  2. GMX uses relative redirects which base.rb does not support yet

The third reason is a change of redirects. I have fixed this, but it is currently not working, and I don't understand why, since when recording the session in Firefox the redirects and cookies are exactly the same.

Would you be willing to collaborate on a fix? I can send a patch with the current status.

get contact form yahoo only get 9 contacts

Hi liangzan, when I try Contacts.new(:yahoo, email_yahoo, password_yahoo).contacts.size
I only get 9 contacts, I've more than 10 contacts on my account, do you know why this happen?

Thanks

Remove historical reference to RubyForge

Hi,

I've been using the contacts gem for about 3 years now. I'm glad to see that there's still someone working on it.

I think it's time to forget some parts of the past. I propose to remove the RubyForge link.
It's the first url visible on the GitHub project page but the RubyForge page hasn't been updated for more than 3 years.

This could be a little bit confusing for new users of your gem.

undefined contacts for nil

If I use guess, I get this....

1.9.2p318 :002 > Contacts.guess('username', 'password').contacts
NoMethodError: undefined method contacts' for nil:NilClass from (irb):2 from /Users/aa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands/console.rb:47:instart'
from /Users/aa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands/console.rb:8:in start' from /Users/aa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands.rb:41:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

AND

1.9.2p318 :001 > Contacts.guess('[email protected]', 'password').contacts
NoMethodError: undefined method contacts' for #<Array:0x000001062f20e0> from (irb):1 from /Users/aa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands/console.rb:47:instart'
from /Users/aa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands/console.rb:8:in start' from /Users/aa/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands.rb:41:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

However, if I use the gmail version, it works. Why would that be? How do I get guess working.

THANK YOU!

Gmail not working.

Hi, when i try to find contacts for gmail it give authentication error although my credentials are correct.

I try:
Contacts::Gmail.new("[email protected]","password").conacts

Error:
Contacts::AuthenticationError: Username or password are incorrect
from /home/chandra/.rvm/gems/ruby-1.9.3-p194@itour/bundler/gems/contacts-a8f76537e8b1/lib/contacts/gmail.rb:38:in `rescue in real_connect'

But it works fine for other mail except gmail.

Would you please figure out why its so.

In gem file i have:
gem "liangzan-contacts", :git => 'git://github.com/liangzan/contacts.git'

new encoding problem with hotmail

Getting some errores like this :-(

A Encoding::InvalidByteSequenceError occurred in imported_contacts#import_provider:

""T" on UTF-16
/home/rails/www.nounou-top.fr/shared/bundle/ruby/1.9.1/bundler/gems/contacts-3a3f1c269235/lib/contacts/hotmail.rb:68:in `encode'

problem with ruby 1.9.3

Hi!

In ruby 1.9.2 gmail and yahoo work fine for me, but when switching to 1.9.3, I have following errors:

yahoo:
gems/liangzan-contacts-1.2.9/lib/contacts/yahoo.rb:17:in real_connect': undefined methodindex' for nil:NilClass (NoMethodError)

hotmail:
gems/liangzan-contacts-1.2.9/lib/contacts/hotmail.rb:21:in real_connect': undefined methodsplit' for nil:NilClass (NoMethodError)

In general it looks like data got from 'post/get' methods is nil...

gmail works fine

I tested ruby-1.9.3-p0 [ x86_64 ] and ruby-1.9.3-p125 [ x86_64 ] both have the same error.

Thanks for any suggestions.

Hotmail not working anymore

Didn't change anything to my server or code but since 5 days I'm getting this error (only with hotmail.)
Tried to update the gem to 1.2.26 : it didn't change anything.

"undefined method `[]' for nil:NilClass" when calling

@contacts = (site.new('login', 'password').contacts) || []

it seems the problem come from here (don't know exactly which line since my debugguer is giving me some problems :s ):

in hotmail.rb

def real_connect
   (...)
 data, resp, cookies, forward = get(URL)
  old_url = URL
  until forward.nil?
    data, resp, cookies, forward, old_url = get(forward, cookies, old_url) + [forward]
  end

  postdata =  "PPSX=%s&PwdPad=%s&login=%s&passwd=%s&LoginOptions=2&PPFT=%s" % [
    CGI.escape(data.split("><").grep(/PPSX/).first[/=\S+$/][2..-3]),
    PWDPAD[0...([email protected])],
    CGI.escape(login),
    CGI.escape(password),
    CGI.escape(data.split("><").grep(/PPFT/).first[/=\S+$/][2..-3])
  ]

(...)
end

Utf-8 problem with Hotmail in haml on Ruby 1.9.3

Regarding to following commit wearedalt@4f979e6 the data returned from Hotmail is in ISO-8859-1 and if we want to show the results in a template usign HAML as template language and we got the error :

incompatible character encodings: ASCII-8BIT and UTF-8

Here is an example of a contact name returned by Hotmail using the gem :
"M\xE9la De R."

This can not be parsed by HAML, is it possible to change the hotmail return back to UTF-8?

More informations about versions

Hi,

Currently I have some difficulty each time I want to update the contacts gem.
Before installing a new version, I'm used to check what changes comes with the new version but your gem doesn't provide any information about any change.

I think this could help:

  • adding a changelog file
  • creating a tag per release
  • mentioning version in commit message (eg. bumped the version to 1.2.25)

I also noticed that some popular gems add a <project_name>/version.rb file that they use in their gemspec file.

What do you think about this?

Not working with yahoo

I am getting this error while using Contacts::Yahoo.new(login,password).contacts
undefined method []' for nil:NilClass from /home/sodel/s195/vendor/plugins/contacts/lib/contacts/yahoo.rb:53:incontacts'
from (irb):4
from /home/sodel/.rvm/gems/ruby-1.9.3-p429@sports195/gems/railties-3.0.19/lib/rails/commands/console.rb:44:in start' from /home/sodel/.rvm/gems/ruby-1.9.3-p429@sports195/gems/railties-3.0.19/lib/rails/commands/console.rb:8:instart'
from /home/sodel/.rvm/gems/ruby-1.9.3-p429@sports195/gems/railties-3.0.19/lib/rails/commands.rb:23:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'

Error with hotmail since some days

Didn't change anything to my code and I'm getting this error since a week with Hotmail only :
Any idea ?

CSV::MalformedCSVError in ImportedContactsController#import_provider

Missing or stray quote in line 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.