graybook 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/VERSION.yml +1 -1
- data/VERSION_NAME +1 -1
- data/lib/graybook/importer/aol.rb +5 -4
- data/lib/graybook/importer/gmail.rb +3 -2
- data/lib/graybook/importer/hotmail.rb +3 -2
- data/lib/graybook/importer/page_scraper.rb +1 -2
- data/lib/graybook/importer/yahoo.rb +2 -2
- data/lib/graybook.rb +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
data/VERSION.yml
CHANGED
data/VERSION_NAME
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Gray
|
1
|
+
Gray Groundhog
|
@@ -29,17 +29,18 @@ class Graybook::Importer::Aol < Graybook::Importer::PageScraper
|
|
29
29
|
|
30
30
|
case page.body
|
31
31
|
when /Invalid Screen Name or Password. Please try again./
|
32
|
-
return Problem.new("Username and password were not accepted. Please check them and try again.")
|
32
|
+
return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
|
33
33
|
when /Terms of Service/
|
34
|
-
return Problem.new("Your AOL account is not setup for WebMail. Please signup: http://webmail.aol.com")
|
34
|
+
return Graybook::Problem.new("Your AOL account is not setup for WebMail. Please signup: http://webmail.aol.com")
|
35
35
|
end
|
36
36
|
|
37
37
|
# aol bumps to a wait page while logging in. if we can't scrape out the js then its a bad login
|
38
38
|
extractor = proc { |var_name| page.body.scan(/var\s*#{var_name}\s*=\s*\"(.*?)\"\s*;/).first.first }
|
39
39
|
|
40
40
|
base_uri = extractor.call( 'gSuccessPath' )
|
41
|
-
return Problem.new("An error occurred. Please try again.") unless base_uri
|
41
|
+
return Graybook::Problem.new("An error occurred. Please try again.") unless base_uri
|
42
42
|
page = agent.get base_uri
|
43
|
+
true
|
43
44
|
end
|
44
45
|
|
45
46
|
##
|
@@ -56,7 +57,7 @@ class Graybook::Importer::Aol < Graybook::Importer::PageScraper
|
|
56
57
|
|
57
58
|
def scrape_contacts
|
58
59
|
unless auth_cookie = agent.cookies.find{|c| c.name =~ /^Auth/}
|
59
|
-
return Problem.new("An error occurred. Please try again.")
|
60
|
+
return Graybook::Problem.new("An error occurred. Please try again.")
|
60
61
|
end
|
61
62
|
|
62
63
|
# jump through the hoops of formulating a request to get printable contacts
|
@@ -33,11 +33,12 @@ class Graybook::Importer::Gmail < Graybook::Importer::PageScraper
|
|
33
33
|
form.Passwd = options[:password]
|
34
34
|
page = agent.submit(form,form.buttons.first)
|
35
35
|
|
36
|
-
return Problem.new("Username and password were not accepted. Please check them and try again.") if page.body =~ /Username and password do not match/
|
36
|
+
return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.") if page.body =~ /Username and password do not match/
|
37
37
|
|
38
38
|
if page.search('//meta').first.attributes['content'] =~ /url='?(http.+?)'?$/i
|
39
39
|
page = agent.get $1
|
40
40
|
end
|
41
|
+
true
|
41
42
|
end
|
42
43
|
|
43
44
|
##
|
@@ -54,7 +55,7 @@ class Graybook::Importer::Gmail < Graybook::Importer::PageScraper
|
|
54
55
|
unless agent.cookies.find { |c|
|
55
56
|
c.name == 'GAUSR' && c.value.match(/mail(.*?):#{options[:username]}/)
|
56
57
|
}
|
57
|
-
return Problem.new("Username and password were not accepted. Please check them and try again.")
|
58
|
+
return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
|
58
59
|
end
|
59
60
|
|
60
61
|
page = agent.get('http://mail.google.com/mail/h/?v=cl&pnl=a')
|
@@ -51,10 +51,11 @@ class Graybook::Importer::Hotmail < Graybook::Importer::PageScraper
|
|
51
51
|
# Check for login success
|
52
52
|
if page.body =~ /The e-mail address or password is incorrect/ ||
|
53
53
|
page.body =~ /Sign in failed\./
|
54
|
-
return Problem.new("Username and password were not accepted. Please check them and try again.")
|
54
|
+
return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
|
55
55
|
end
|
56
56
|
|
57
57
|
@first_page = agent.get( page.body.scan(/http\:\/\/[^"]+/).first )
|
58
|
+
true
|
58
59
|
end
|
59
60
|
|
60
61
|
##
|
@@ -71,7 +72,7 @@ class Graybook::Importer::Hotmail < Graybook::Importer::PageScraper
|
|
71
72
|
|
72
73
|
def scrape_contacts
|
73
74
|
unless agent.cookies.find{|c| c.name == 'MSPPre' && c.value == options[:username]}
|
74
|
-
return Problem.new("Username and password were not accepted. Please check them and try again.")
|
75
|
+
return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
|
75
76
|
end
|
76
77
|
|
77
78
|
page = agent.get('http://mail.live.com/')
|
@@ -24,7 +24,7 @@ class Graybook::Importer::Yahoo < Graybook::Importer::PageScraper
|
|
24
24
|
page = agent.submit(form, form.buttons.first)
|
25
25
|
|
26
26
|
if page.body =~ /Invalid ID or password./ || page.body =~ /This ID is not yet taken./
|
27
|
-
return Problem.new("Username and password were not accepted. Please check them and try again.")
|
27
|
+
return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
|
28
28
|
end
|
29
29
|
|
30
30
|
true
|
@@ -43,7 +43,7 @@ class Graybook::Importer::Yahoo < Graybook::Importer::PageScraper
|
|
43
43
|
def scrape_contacts
|
44
44
|
page = agent.get("http://address.yahoo.com/?1=&VPC=import_export")
|
45
45
|
if page.body =~ /To access Yahoo! Address Book\.\.\..*Sign in./m
|
46
|
-
return Problem.new("Username and password were not accepted. Please check them and try again.")
|
46
|
+
return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
|
47
47
|
end
|
48
48
|
form = page.forms.last
|
49
49
|
csv = agent.submit(form, form.buttons[2]) # third button is Yahoo-format CSV
|
data/lib/graybook.rb
CHANGED