Code Monkey home page Code Monkey logo

contactlist's Introduction

contactlist

contactlist是一个获取用户的msn和邮箱联系人列表的java类库,支持的邮箱包括hotmail, gmail, yahoo, sohu, sina, 163, 126, tom, yeah, 189和139。

contactlist项目首页和jar包下载在 http://code.google.com/p/contact-list/

contactlist项目源代码在 http://github.com/flyerhzm/contactlist , google code svn不再更新

特别提示: 最近yahoo邮箱需要增加信息才能登录,请确保可以通过Firefox浏览器登录yahoo邮箱。


Example


try {
    ContactsImporter importer = ContactsImporterFactory.getHotmailContacts(username, password);
    List<Contact> contacts = importer.getContacts();
    for (Contact contact : contacts) {
        System.out.println(contact.getUsername() + ": " + contact.getEmail());
    }
} catch (ContactsException ex) {
    ex.printStackTrace();
}

Encoding

项目的输出统一为UTF-8。
对于运行在locale为UTF-8环境(如:Ubuntu, Mac OS X)下的程序,无需任何调整。
对于运行在locale为GBK环境(如:Windows XP)下的程序,需要手动调整编码:


try {
    ContactsImporter importer = ContactsImporterFactory.getHotmailContacts(username, password);
    List<Contact> contacts = importer.getContacts();
    for (Contact contact : contacts) {
        String username = new String(contact.getUsername().getBytes("UTF-8"), "GBK");
        System.out.println(username + ": " + contact.getEmail());
    }
} catch (ContactsException ex) {
    ex.printStackTrace();
}

另外,在windows下面需要把项目的编码设置为UTF-8,并且确保java文件的编译是用UTF-8的


Project Introduction

contact-list类库依赖包之commons-httpclient — http://www.huangzhimin.com/entries/142-contact-list-library-dependency-of-commons-httpclient
contact-list类库依赖包之msnmlib — http://www.huangzhimin.com/entries/147-contact-list-library-dependency-of-msnmlib
contact-list类库依赖包之json — http://www.huangzhimin.com/entries/158-contact-list-of-the-json-library-dependency

持续更新中…


How to run unit test

出于安全的考虑,没有把单元测试中的邮箱配置文件和msn配置文件放到svn上,如果需要运行mvn test的话,可以按以下步骤:

  • 新建src/test/resources/email.properties文件,形式如下:

gmail.username = [email protected]
gmail.password = yyy

hotmail.username = [email protected]
hotmail.password = yyy

livecn.username = [email protected]
livecn.password = yyy

onesixthree.username = [email protected]
onesixthree.password = yyy

onetwosix.username = [email protected]
onetwosix.password = yyy

sina.username = [email protected]
sina.password = yyy

sohu.username = [email protected]
sohu.password = yyy

tom.username = [email protected]
tom.password = yyy

yahoo.username = [email protected]
yahoo.password = yyy

yahoocn.username = [email protected]
yahoocn.password = yyy

yahoocomcn.username = [email protected]
yahoocomcn.password = yyy

yeah.username = [email protected]
yeah.password = yyy

oneeightnine.username = [email protected]
oneeightnine.password = yyy

onethreenine.username = [email protected]
onethreenine.password = yyy
  • 新建src/test/resources/msn.properties文件,形式如下:

username = [email protected]
password = yyy
  • 在命令行执行mvn test

Change Log

  • 1.1:
    First public release
  • 1.2:
    Fix issue that hotmail can only get first page contact list
  • 1.3:
    Fix issue for some special sohu mail account
  • 1.4:
    Fix issue that 163 mail can only get other group contacts
  • 1.5:
    Fix issue that 126 and yeah mail can only get other group contacts
  • 1.6:
    Add 189 and 139 mail support
  • 1.6.1:
    Meet another style 189 mail and add 139 mail importer to ContactsImporterFactory

Other

需要留言的话,可以上 http://www.huangzhimin.com/projects/1-contact-list ,我会尽快回复的

由于这个类库的原理是使用抓取网页来分析联系人列表的,所以会因为邮箱网页的改版而无法正确获取联系人列表。
如果大家在使用的时候发现有邮箱不能获得联系人列表,希望先把类库log4j的level设置为debug,把调试信息和错误信息一起发送给我[email protected],我会尽快解决问题的,谢谢!

contactlist's People

Contributors

flyerhzm avatar

Watchers

 avatar  avatar  avatar

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.