liangzan-contacts 1.2.13 → 1.2.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/contacts.rb +1 -0
  2. data/lib/contacts/web_de.rb +78 -0
  3. metadata +11 -10
data/lib/contacts.rb CHANGED
@@ -11,3 +11,4 @@ require 'plaxo'
11
11
  require 'aol'
12
12
  require 'mailru'
13
13
  require 'gmx'
14
+ require 'web_de'
@@ -0,0 +1,78 @@
1
+ class Contacts
2
+ class WebDe < Base
3
+ LOGIN_URL = "https://uas2.uilogin.de/centrallogin-3.1/login"
4
+ ADDRESS_BOOK_URL = "https://mm.web.de/contacts"
5
+
6
+
7
+ attr_accessor :cookies
8
+
9
+ def real_connect
10
+ postdata = "serviceID=%s&username=%s&password=%s" % [
11
+ CGI.escape('mobile.web.mail.webde.live'),
12
+ CGI.escape(login),
13
+ CGI.escape(password)
14
+ ]
15
+
16
+ data, resp, self.cookies, forward = post(LOGIN_URL, postdata, "")
17
+
18
+ if !forward.index("/success")
19
+ raise AuthenticationError, "Username and password do not match"
20
+ end
21
+
22
+ data, resp, self.cookies, forward = get(forward, self.cookies)
23
+
24
+ end
25
+
26
+ def contacts
27
+ url = ADDRESS_BOOK_URL
28
+ @contacts = []
29
+
30
+ begin
31
+ data, resp, self.cookies, forward = get(url, self.cookies)
32
+ data, resp, cookies, forward = get(forward, self.cookies)
33
+
34
+ doc = Nokogiri(data)
35
+
36
+ (doc/'ul[id=addressLines]/li').each do |li|
37
+ links = (li/'a')
38
+
39
+ name = links[0].text.strip
40
+ name = name.split(', ').reverse.join(' ')
41
+
42
+ next if links[1].nil?
43
+
44
+ match = links[1]['href'].match('to=([^&]+)')
45
+
46
+ next if !match
47
+
48
+ email = match[1].strip
49
+
50
+ @contacts << [ name, email ]
51
+ end
52
+
53
+ a_next = doc.at('a[id=go-next]')
54
+
55
+ unless a_next.nil?
56
+ url = ADDRESS_BOOK_URL + '?' + a_next[:href].split('?')[1]
57
+ else
58
+ url = nil
59
+ end
60
+
61
+ end while !url.nil?
62
+
63
+ @contacts
64
+ end
65
+
66
+ def skip_gzip?
67
+ false
68
+ end
69
+
70
+ private
71
+
72
+ def header_row?(row)
73
+ row[0] == 'Last Name'
74
+ end
75
+ end
76
+
77
+ TYPES[:web_de] = WebDe
78
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liangzan-contacts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.13
4
+ version: 1.2.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -17,7 +17,7 @@ date: 2012-03-16 00:00:00.000000000Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: json
20
- requirement: &14981960 !ruby/object:Gem::Requirement
20
+ requirement: &16259460 !ruby/object:Gem::Requirement
21
21
  none: false
22
22
  requirements:
23
23
  - - ~>
@@ -25,10 +25,10 @@ dependencies:
25
25
  version: 1.6.5
26
26
  type: :runtime
27
27
  prerelease: false
28
- version_requirements: *14981960
28
+ version_requirements: *16259460
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: gdata_19
31
- requirement: &14980420 !ruby/object:Gem::Requirement
31
+ requirement: &16258000 !ruby/object:Gem::Requirement
32
32
  none: false
33
33
  requirements:
34
34
  - - ~>
@@ -36,10 +36,10 @@ dependencies:
36
36
  version: 1.1.3
37
37
  type: :runtime
38
38
  prerelease: false
39
- version_requirements: *14980420
39
+ version_requirements: *16258000
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: nokogiri
42
- requirement: &14979580 !ruby/object:Gem::Requirement
42
+ requirement: &16257180 !ruby/object:Gem::Requirement
43
43
  none: false
44
44
  requirements:
45
45
  - - ~>
@@ -47,15 +47,16 @@ dependencies:
47
47
  version: 1.5.0
48
48
  type: :runtime
49
49
  prerelease: false
50
- version_requirements: *14979580
51
- description: A universal interface to grab contact list information from various providers
52
- including Yahoo, AOL, Gmail, Hotmail, and Plaxo. Now supporting Ruby 1.9.
50
+ version_requirements: *16257180
51
+ description: A universal interface to grab contact list information from Yahoo, AOL,
52
+ Gmail, Hotmail, Plaxo, GMX, Web.de. Now supporting Ruby 1.9.
53
53
  email: zan@liangzan.net
54
54
  executables: []
55
55
  extensions: []
56
56
  extra_rdoc_files: []
57
57
  files:
58
58
  - lib/contacts/base.rb
59
+ - lib/contacts/web_de.rb
59
60
  - lib/contacts/gmail.rb
60
61
  - lib/contacts/plaxo.rb
61
62
  - lib/contacts/yahoo.rb
@@ -92,5 +93,5 @@ rubyforge_project:
92
93
  rubygems_version: 1.8.10
93
94
  signing_key:
94
95
  specification_version: 3
95
- summary: grab contacts from Yahoo, AOL, Gmail, Hotmail, Plaxo and GMX
96
+ summary: grab contacts from Yahoo, AOL, Gmail, Hotmail, Plaxo, GMX and Web.de
96
97
  test_files: []