AddressBookImporter 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +2 -0
- data/lib/address_book_importer.rb +11 -4
- metadata +2 -2
data/History.txt
CHANGED
|
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
|
2
2
|
require 'mechanize'
|
|
3
3
|
|
|
4
4
|
module AddressBookImporter
|
|
5
|
-
VERSION =
|
|
5
|
+
VERSION = "0.0.2"
|
|
6
6
|
class EmptyEmailException < Exception ; end
|
|
7
7
|
class LoginErrorException < Exception ; end
|
|
8
8
|
class ParseException < Exception ; end
|
|
@@ -45,10 +45,16 @@ module AddressBookImporter
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def fetch_contacts(page)
|
|
48
|
-
link = page.links.select{|l|l.node.at('a')['href'] =~ /addresses/}.first.node.at('a')['href'].match(/'(.*)'/)[1]
|
|
49
48
|
params = page.body.match(/(&curmbox[^"]+)/)[1]
|
|
50
|
-
|
|
51
|
-
contact_page
|
|
49
|
+
start = params.match(/(a=.*)/)[1]
|
|
50
|
+
contact_page = @agent.get("/cgi-bin/AddressPicker?" + start+params + "&Context=InsertAddress&_HMaction=Edit&qF=to")
|
|
51
|
+
rval = []
|
|
52
|
+
match_string = contact_page.body
|
|
53
|
+
while !(match = match_string.match(/'([^@\s]+@[-a-z0-9]+\.+[a-z]{2,})'/)).nil?
|
|
54
|
+
rval << match[1]
|
|
55
|
+
match_string = match.post_match
|
|
56
|
+
end
|
|
57
|
+
rval
|
|
52
58
|
end
|
|
53
59
|
end
|
|
54
60
|
|
|
@@ -91,3 +97,4 @@ module AddressBookImporter
|
|
|
91
97
|
end
|
|
92
98
|
end
|
|
93
99
|
end
|
|
100
|
+
|
metadata
CHANGED
|
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
|
3
3
|
specification_version: 1
|
|
4
4
|
name: AddressBookImporter
|
|
5
5
|
version: !ruby/object:Gem::Version
|
|
6
|
-
version: 0.0.
|
|
7
|
-
date: 2006-11-
|
|
6
|
+
version: 0.0.2
|
|
7
|
+
date: 2006-11-27 00:00:00 +01:00
|
|
8
8
|
summary: Mechanize scraper for address books
|
|
9
9
|
require_paths:
|
|
10
10
|
- lib
|