graybook 1.0.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGES.md +49 -0
  3. data/Manifest.txt +59 -0
  4. data/README.md +66 -0
  5. data/Rakefile +40 -0
  6. data/VERSION +1 -0
  7. data/VERSION.yml +4 -0
  8. data/VERSION_NAME +1 -0
  9. data/debug_graybook.rb +10 -0
  10. data/init.rb +1 -0
  11. data/lib/graybook/exporter/base.rb +16 -0
  12. data/lib/graybook/exporter/vcf.rb +45 -0
  13. data/lib/graybook/exporter/xml.rb +28 -0
  14. data/lib/graybook/importer/aol.rb +87 -0
  15. data/lib/graybook/importer/base.rb +39 -0
  16. data/lib/graybook/importer/csv.rb +74 -0
  17. data/lib/graybook/importer/freenet.rb +62 -0
  18. data/lib/graybook/importer/gmail.rb +84 -0
  19. data/lib/graybook/importer/gmx.rb +68 -0
  20. data/lib/graybook/importer/hotmail.rb +135 -0
  21. data/lib/graybook/importer/page_scraper.rb +86 -0
  22. data/lib/graybook/importer/web.de.rb +67 -0
  23. data/lib/graybook/importer/yahoo.rb +63 -0
  24. data/lib/graybook.rb +83 -0
  25. data/test/config/credentials.yml.example +9 -0
  26. data/test/fixtures/aol_application_page.html +566 -0
  27. data/test/fixtures/aol_bad_login_response_stage_3.html +565 -0
  28. data/test/fixtures/aol_contacts.html +102 -0
  29. data/test/fixtures/aol_login_response_stage_1.html +158 -0
  30. data/test/fixtures/aol_login_response_stage_2.html +559 -0
  31. data/test/fixtures/aol_login_response_stage_3.html +48 -0
  32. data/test/fixtures/aol_login_response_stage_4.html +404 -0
  33. data/test/fixtures/aol_login_response_stage_5.html +404 -0
  34. data/test/fixtures/aol_new_contacts.html +431 -0
  35. data/test/fixtures/gmail.csv +3 -0
  36. data/test/fixtures/gmail_bad_login_response_stage_2.html +560 -0
  37. data/test/fixtures/gmail_contacts.html +228 -0
  38. data/test/fixtures/gmail_login_response_stage_1.html +556 -0
  39. data/test/fixtures/gmail_login_response_stage_2.html +1 -0
  40. data/test/fixtures/gmail_login_response_stage_2a.html +1 -0
  41. data/test/fixtures/gmail_login_response_stage_3.html +249 -0
  42. data/test/fixtures/gmail_redirect_body.html +10 -0
  43. data/test/fixtures/hotmail_bad_login_response_stage_2.html +31 -0
  44. data/test/fixtures/hotmail_contacts.html +262 -0
  45. data/test/fixtures/hotmail_login_response_stage_1.html +31 -0
  46. data/test/fixtures/hotmail_login_response_stage_2.html +1 -0
  47. data/test/fixtures/hotmail_login_response_stage_3.html +519 -0
  48. data/test/fixtures/hotmail_scrape_first_page.html +77 -0
  49. data/test/fixtures/hotmail_scrape_response_stage_1.html +90 -0
  50. data/test/fixtures/hotmail_scrape_response_stage_2.html +77 -0
  51. data/test/fixtures/hotmail_scrape_response_stage_3.html +0 -0
  52. data/test/fixtures/yahoo_bad_login_response_stage_2.html +443 -0
  53. data/test/fixtures/yahoo_contacts.csv +3 -0
  54. data/test/fixtures/yahoo_contacts_not_logged_in.html +432 -0
  55. data/test/fixtures/yahoo_contacts_stage_1.html +399 -0
  56. data/test/fixtures/yahoo_login_response_stage_1.html +433 -0
  57. data/test/fixtures/yahoo_login_response_stage_2.html +16 -0
  58. data/test/fixtures/yahoo_no_user_response_stage_2.html +574 -0
  59. data/test/freenet_importer_test.rb +53 -0
  60. data/test/gmx_importer_test.rb +53 -0
  61. data/test/scripts/live_test.rb +25 -0
  62. data/test/test_graybook.rb +60 -0
  63. data/test/test_graybook_exporter_base.rb +16 -0
  64. data/test/test_graybook_exporter_vcf.rb +52 -0
  65. data/test/test_graybook_exporter_xml.rb +16 -0
  66. data/test/test_graybook_importer_aol.rb +108 -0
  67. data/test/test_graybook_importer_base.rb +24 -0
  68. data/test/test_graybook_importer_csv.rb +60 -0
  69. data/test/test_graybook_importer_gmail.rb +116 -0
  70. data/test/test_graybook_importer_hotmail.rb +165 -0
  71. data/test/test_graybook_importer_page_scraper.rb +51 -0
  72. data/test/test_graybook_importer_yahoo.rb +137 -0
  73. data/test/test_helper.rb +71 -0
  74. data/test/web.de_importer_test.rb +53 -0
  75. data/updater.rb +15 -0
  76. data/vendor/plugins/graybook/lib/autotest/discover.rb +3 -0
  77. data/vendor/plugins/graybook/lib/autotest/graybook.rb +27 -0
  78. metadata +185 -0
@@ -0,0 +1,574 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
9
+ <html>
10
+ <head>
11
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
12
+ <title>Sign in to Yahoo!</title>
13
+ <!-- Refresh login page every 15 minutes -->
14
+ <meta http-equiv="Pragma" content="no-cache">
15
+ <meta http-equiv="Expires" content="0">
16
+ <meta http-equiv="refresh" content="900">
17
+
18
+ <style type="text/css">
19
+
20
+
21
+
22
+ @import url(https://a248.e.akamai.net/sec.yimg.com/lib/reg/css/yregbase_sec_200808110948_01.css);
23
+ .ct{background:transparent url(https://a248.e.akamai.net/sec.yimg.com/i/reg/cs.gif) no-repeat top right;top:-1px}
24
+ .ct .cl{background:transparent url(https://a248.e.akamai.net/sec.yimg.com/i/reg/cs.gif) no-repeat top left}
25
+ .cb{background:transparent url(https://a248.e.akamai.net/sec.yimg.com/i/reg/cs.gif) no-repeat bottom right;bottom:-1px}
26
+ .cb .cl{background:transparent url(https://login.yahoo.com/i/reg/cs.gif) no-repeat bottom left}
27
+ .clear{clear:both}
28
+ #yreglg select, #yreglg input, #yreglg p, #yreglgtb td, #yreglgtb th{font-size:93%}
29
+ div.yregdsilu h2.yregdnt, div.yregdsilu p.yregsueasy{width:110px}
30
+ /*popup template css */
31
+ #yregtpopup #yregtxt {width:260px;margin:0 0 10px} /* popup template */
32
+ #yregtpopup #yregwp, #yregtpopup #yregmst{width:525px}
33
+ #yregtpopup #yregmst{margin-bottom:5px}
34
+ #yregtpopup #yreglg{margin-bottom:0}
35
+ #yregtpopup #yregft{padding-top:5px}
36
+
37
+ #yregtgen #yregtxt h2, #yregtpopup #yregtxt h2, #yregpmtxt h3{font:bold 152%/152% arial;color:#333;margin:0}
38
+ #yregtgen #yregtxt p.yregpti, #yregtpopup #yregtxt p.yregpti {color:#666;margin:0 0 2px;font:bold 100%/100% arial}
39
+ #yregtgen #yregtxt, #yregtpopup #yregtxt{margin-bottom:20px}
40
+ #yregtgen #yregtxt #yreghtxt h3, #yregtpopup #yregtxt #yreghtxt h3{margin:0;font:bold 107%/114% arial;color:#8C57A1}
41
+ #yregtgen #yregtxt li h3, #yregtpopup #yregtxt li h3{font:bold 114%/122% arial}
42
+ #yregtgen #yregtxt p, #yregtpopup #yregtxt p{margin:0 0 0.8em;line-height:129%}
43
+ #yregtgen #yregtxt .yregbpt li, #yregtpopup #yregtxt .yregbpt li{margin:0 0 10px 4px;padding:0 0 10px 22px;background:url(https://a248.e.akamai.net/sec.yimg.com/i/reg/purple_arrow.gif) no-repeat 1px 4px}
44
+
45
+ #yregtgen.yregab #yregtxt{width:auto;}
46
+ #yregtgen.yregab #yreghtxt{margin-right:60px;}
47
+ #yregtpopup.yregab #yregtxt{width:180px}
48
+ #yregtgen #yregtxt #yreghtxt h2, #yregtpopup #yregtxt #yreghtxt h2{color:#7A067F}
49
+ .yregbx{z-index:3;margin-right:0!important}
50
+ .flicker h3 span {color:#ff0084;font-weight:bold}
51
+ .flicker h3 a {text-decoration:underline;}
52
+
53
+ /* persistency message right above "sign in" bottom */
54
+ em.nwred a {font-style: normal; font-size: 85%; vertical-align:5px;}
55
+ .kmsibold {font-weight:bold; font-size: 114%;}
56
+ input#persistent {margin-bottom: -0em;}
57
+ .subperstxt {line-height:1.75em;}
58
+ .subperstxt2 {margin: 0 0 0 2em; display:block;}
59
+ /* #yregft p.yregfb { font-size:120%; padding-bottom: 5px; padding-up: 5px} */
60
+
61
+ .yreglgsb{margin-top:0}
62
+
63
+ #yregwp #yregct #yreglg .yregbxi #yreglgmd {margin-top:1.75em}
64
+ body#yregtgen fieldset {margin-bottom:2.5em}
65
+ #yreglgtb tr {width:17.92em}
66
+ /* p#sigcopys {text-align: left; font-size: 85%; float: right; padding: .4em; margin: .6em .4em 1em 0; border-bottom: 1px dotted #9D9C9D; border-top: 1px dotted #9D9C9D;}
67
+ */
68
+ p#sigcopys {text-align: left; font-size: 85%; padding: .4em; margin: .6em .0em 1em 0; border-bottom: 1px dotted #9D9C9D; border-top: 1px dotted #9D9C9D;}
69
+ #sigcopys label{display:block; margin:-1.5em 0 0 2em;}
70
+
71
+
72
+ #yregtgen #yregct {margin-right: 0px;}
73
+ #yregtgen #yregtxt { margin-left: 5px; margin-right: 245px }
74
+ </style>
75
+
76
+ <style type="text/css">
77
+
78
+ /*anti phish badge */
79
+ .top {position:relative}
80
+ #antiphish{position:absolute;right:5px;top:5px;}
81
+ #antiphish.dogear{right:0px;top:0px;}
82
+ #antiphish a {font-size:92%;}
83
+ img.picture {border:2px solid}
84
+
85
+ /* badge backgrounds */
86
+ .badge{background-color:#f9f9f9; background-repeat:no-repeat; background-position:top right;}
87
+ .badge #yreglgtb {margin-top:18px;} /* increased badge size */
88
+
89
+
90
+ /* popup code... */
91
+ #security {display:none;position:absolute;top:-15px;left:-85px;z-index:1000;background-color:#a5a5a5;}
92
+ #security.noimage {left:-76px;top:-10px}
93
+ #securityi{position:relative;z-index:1;right:1px;bottom:1px;padding:11px;width:219px;background-color:#fff;border:1px solid #636363;}
94
+ #knob{position:absolute;top:30px;right:-10px;width:10px;height:18px;background:url(https://a248.e.akamai.net/sec.yimg.com/i/reg/sideknob.png) no-repeat top left}
95
+ .noimage #knob{top:22px}
96
+ #security p, #security ul li{font:77%/107% verdana;}
97
+ #security p a {text-decoration:underline;}
98
+ #security p{padding-bottom:5px;}
99
+ #security ul{margin:5px 0 0;padding:0 5px 0 0;text-align:right;list-style:none;}
100
+ #security ul li{margin:0;padding:0 0 2px;}
101
+
102
+ /* help text updates... */
103
+ #yregtgen #yregtxt .yregbpt li ul{margin:10px 0 0;padding:0 0 0 15px;}
104
+ #yregtgen #yregtxt .yregbpt li ul li{background:none;list-style:disc;margin:0 0 5px 0;padding:0;}
105
+ #yreghtxt ul{margin-left:0}
106
+ #yreghtxt ul.inlineHeaders li h3{display:inline;}
107
+ /* remove top margin on li ul */
108
+ .addressbar {display:block;margin:1em 0 1em 0}
109
+ .mono{font-family: courier new, courier, monospace;color:#000;font-weight:bold}
110
+
111
+
112
+ #rcta {width:99%; border:1px solid #898989; margin-top:10px; background-image:url(https://a248.e.akamai.net/sec.yimg.com/i/reg/gradient.png); background-repeat:repeat-x; background-color:#fde37c}
113
+ .ct {background:url(https://a248.e.akamai.net/sec.yimg.com/i/reg/cs.gif) no-repeat scroll right top; top:-1px}
114
+ .ct .cl {background:url(https://a248.e.akamai.net/sec.yimg.com/i/reg/cs.gif) no-repeat scroll left top;}
115
+ #rcta .key {width:40px; height:40px; border:1px solid #666666; background-image:url(https://a248.e.akamai.net/sec.yimg.com/i/reg/key.png); background-repeat: no-repeat; float:left; margin-top:1px}
116
+ #rcta .txt {margin-left:48px}
117
+ .cb {background:url(https://a248.e.akamai.net/sec.yimg.com/i/reg/cs.gif) no-repeat scroll right bottom; bottom:-1px}
118
+ .cb .cl {background:url(https://a248.e.akamai.net/sec.yimg.com/i/reg/cs.gif) no-repeat scroll left bottom;}
119
+ #rcta .ctact {margin:4px 10px;min-height:44px}
120
+ #rcta .txt .qs {font:normal bold 92% arial, Helvetica, sans-serif; color:#000; text-decoration:none}
121
+ #rcta .txt .sl {font:normal normal 100% arial, Helvetica, sans-serif; color:#000; text-decoration:none}
122
+ #rcta .txt .why {font:normal normal 85% arial, Helvetica, sans-serif;}
123
+ #rcta .txt .sltxt {line-height:0.9em}
124
+ .sltxt a {line-height:0.5em; font-size:85%}
125
+ .sltxt .why a{font-size:100%}
126
+ .yregertxt { margin-top: 25px }
127
+ .yreglgsut { margin-top: 15px }
128
+ </style>
129
+ <!--[if IE]>
130
+ <style type="text/css">
131
+ .yregclb{height:1%}
132
+ #yreglgtb td{text-align:left}
133
+ #yreglgtb td input{width:110px}
134
+ #antiphish img{right:15px}
135
+ #antiphish.dogear{right:1px;top:1px;}
136
+ #knob{background:url(https://a248.e.akamai.net/sec.yimg.com/i/reg/sideknob_b.gif);right:-11px}
137
+ .badge #yreglgtb {margin-top:20px;}
138
+ #rcta .key {margin-top:0}
139
+ .badge {height:1%}
140
+ </style>
141
+ <![endif]-->
142
+
143
+ <!--[if lte IE 6]>
144
+ <style type="text/css">
145
+ .yregclb{height:30em}
146
+ #yregtxt {height:1%}
147
+ </style>
148
+ <![endif]-->
149
+
150
+
151
+ <!--[if IE]>
152
+ <style type="text/css">
153
+ .yregclb,.yregbxi,.yregbx {height:1%}
154
+ #yreglgtb td{text-align:left}
155
+ #yregtxt #banner div{position:static} /* ie z-index context stacking bug work-around */
156
+ #yregtpopup #yregtxt{clear:both; float:left;}
157
+ #yregct{padding:0 0 30px}
158
+ .yregbx{width: 100%}
159
+ </style>
160
+ <![endif]-->
161
+
162
+ <!--[if IE 6]>
163
+ <style type="text/css">
164
+ .yregclb{height:30em}
165
+ #yregtxt {height:1%}
166
+ /*p#sigcopys {margin-right:0.2em}*/
167
+ </style>
168
+ <![endif]-->
169
+
170
+
171
+
172
+ <style type="text/css">
173
+ .dbidTip{color:#ff0000}
174
+
175
+ #yreglgtb, #yreglgtb th {text-align: left; width: 100%;}
176
+ #yreglgtb td { width:179px; text-align: left; padding: 0 0 16px 0}
177
+ #yreglgtb td input{ width:179px }
178
+ .dbidTip {padding: 3px 0 0 0; font-size:85%}
179
+ </style>
180
+
181
+
182
+
183
+
184
+ </head>
185
+ <!-- ads: 150001456 INT.OFFSET: 0 -->
186
+ <body id="yregtgen">
187
+
188
+ <div id="yregwp">
189
+ <!-- begin header -->
190
+ <table id="yregmst" width="750" cellpadding="0" cellspacing="0" border="0"><tr valign="top">
191
+ <td width="100%"><table width="100%" cellspacing="0" border="0"><tr valign="top">
192
+ <td width="1%"><img src="https://a248.e.akamai.net/sec.yimg.com/i/yahoo.gif" alt="Yahoo!" width=147 height=31 border=0></td>
193
+ <td><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr valign="top">
194
+ <td align="right" id="ygmaproplinks" style="padding-right:3px;line-height:12px;"><font face="verdana,geneva,sans-serif" size="-2"><a href="http://www.yahoo.com " target="www" class="header" title="Click here to go to Yahoo! homepage">Yahoo!</a> - <a href="http://help.yahoo.com/help/us/edit/" class="header" target="yhelp" title="Click here for help">Help</a></font></td>
195
+ </tr></table></td></tr></table></td>
196
+ <td align="right" style="padding: 6px 0 0 4px;">
197
+ </td></tr></table>
198
+
199
+
200
+ <!-- end header -->
201
+ <span id="cache"></span>
202
+ <script language="JavaScript">
203
+
204
+ function checkBrowser(){
205
+ var appName = navigator.appName;
206
+ if( appName == "Microsoft Internet Explorer" )
207
+ {
208
+ // this only works in IE 5 for windows and higher ...
209
+ if( navigator.appVersion.indexOf("Windows") == -1 )
210
+ return -1;
211
+ var appVersionAry = navigator.appVersion.split("(");
212
+ if( appVersionAry.length < 2 )
213
+ return -1;
214
+ var appVersion = appVersionAry[1];
215
+ appVersionAry = appVersion.split("; ");
216
+ if( appVersionAry.length < 2 )
217
+ return -1;
218
+ appVersion = appVersionAry[1];
219
+ appVersionAry = appVersion.split(" ");
220
+ if( appVersionAry.length < 2 )
221
+ return -1;
222
+ appVersion = appVersionAry[1];
223
+ var appVersionNumber = parseInt(appVersion);
224
+
225
+ if( appVersionNumber < 5 )
226
+ return -1;
227
+ }
228
+ else
229
+ {
230
+ return -1;
231
+ }
232
+ }
233
+
234
+ </script>
235
+
236
+
237
+ <script language="JavaScript">
238
+
239
+
240
+ function flashCacheReady (initialized){ //invoked directly by Flash
241
+ var inCache = false;
242
+
243
+ // Get the info from flash
244
+ var o={};
245
+ o=(document.getElementById("flashCache")).getCache(o);
246
+ if(o != null) inCache = true;
247
+ else return;
248
+
249
+ if(o.YL != 'null' && o.YL != null) {
250
+ document.cookie = o.YL + ";expires=Thu, 15 Apr 2037 20:00:00 GMT;domain=login.yahoo.com;path=/";
251
+ }
252
+
253
+ if(o.F != 'null' && o.F != null) {
254
+ document.cookie = o.F + ";expires=Thu, 15 Apr 2037 20:00:00 GMT;domain=.yahoo.com;path=/";
255
+ }
256
+
257
+ if(o.YLS != 'null' && o.YLS != null) {
258
+ if((o.YLS.match("n=0")) != null) {
259
+ o.YLS = o.YLS.replace("n=0", "n=9");
260
+ } else {
261
+ o.YLS = o.YLS.concat("&n=9");
262
+ }
263
+ document.cookie = o.YLS + ";expires=Thu, 15 Apr 2037 20:00:00 GMT;domain=.yahoo.com;path=/";
264
+ }
265
+
266
+ if(((o.YL != 'null') && (o.YL != null)) || ((o.F != 'null') && (o.F != null)) && (document.cookie.length > 0)) {
267
+ location.replace (document.location + "&rl=1");
268
+ }
269
+
270
+ // If the browser is IE, get from the xml cache as well.
271
+
272
+ if((checkBrowser() != -1)) {
273
+ function getXML(cookieName,header,spanName)
274
+ {
275
+ var span = document.getElementById("cache");
276
+ span.style.behavior = "url('#default#userData')";
277
+ span.load(spanName);
278
+
279
+ var ckyDate = new Date;
280
+ ckyDate.setDate(ckyDate.getDate( ) + 7);
281
+
282
+ var saved = span.getAttribute("saved"+cookieName);
283
+
284
+ if((saved == null ) || (saved == "")) return -1;
285
+ var cookieStr = saved;
286
+ if(cookieName == "YLS") {
287
+ if((cookieStr.match("n=0")) != null) {
288
+ cookieStr = cookieStr.replace("n=0", "n=9");
289
+ } else {
290
+ cookieStr = cookieStr.concat("&n=9");
291
+ }
292
+ }
293
+ if (header != ""){
294
+ cookieStr = cookieStr + ';' + header;
295
+ }
296
+ document.cookie = cookieStr;
297
+ return 0;
298
+ }
299
+
300
+ var ylRes = getXML("YL", "expires = Thu, 15 Apr 2037 20:00:00 GMT; domain=login.yahoo.com; path=/", "YL");
301
+ var fRes = getXML("F", "expires = Thu, 15 Apr 2037 20:00:00 GMT; domain=.yahoo.com; path=/", "YL");
302
+ var ylsRes = getXML("YLS", "expires = Thu, 15 Apr 2037 20:00:00 GMT; domain=.yahoo.com; path=/", "YL");
303
+
304
+ if(ylRes == 0 || fRes == 0 && (document.cookie.length > 0)) {
305
+ location.replace (document.location + "&rl=1");
306
+ }
307
+ }
308
+ }
309
+ </script>
310
+
311
+
312
+
313
+
314
+
315
+ <script type="text/javascript">
316
+
317
+ function FlashDetector_Detect(targetVersion)
318
+ {
319
+ var pObj = null;
320
+ var tokens, len, curr_tok;
321
+ var hasVersion = -1;
322
+ var playable = false;
323
+ if(navigator.mimeTypes && navigator.mimeTypes['application/x-shockwave-flash'])
324
+ {
325
+ pObj = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin;
326
+ }
327
+ if(pObj != null)
328
+ {
329
+ tokens = navigator.plugins['Shockwave Flash'].description.split(' ');
330
+ len = tokens.length;
331
+ while(len--)
332
+ {
333
+ curr_tok = tokens[len];
334
+ if(!isNaN(parseInt(curr_tok)))
335
+ {
336
+ hasVersion = curr_tok;
337
+ FlashDetector_Version = curr_tok;
338
+ break;
339
+ }
340
+ }
341
+ if(hasVersion >= targetVersion)
342
+ {
343
+ playable = true;
344
+ }
345
+ else
346
+ {
347
+ playable = false;
348
+ }
349
+ }
350
+ return playable;
351
+ }
352
+
353
+ var flashDetector_Playable = false;
354
+ var flashDetector_targetVersion = '8';
355
+
356
+ var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
357
+ var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
358
+ var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
359
+
360
+ if (isIE && isWin && !isOpera) {
361
+ document.write('<scr' + 'ipt language="VBScript"\> \n');
362
+ document.write('on error resume next \n');
363
+ document.write('flashDetector_Playable = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & flashDetector_targetVersion)))\n');
364
+ document.write('</scr' + 'ipt\> \n');
365
+ } else {
366
+ flashDetector_Playable = FlashDetector_Detect(flashDetector_targetVersion);
367
+ }
368
+
369
+ var flashCode = '';
370
+
371
+ if(flashDetector_Playable) {
372
+
373
+ var ts = (new Date()).getTime( );
374
+
375
+ flashCode = '<object type="application/x-shockwave-flash" data="https://login.yahoo.com/login/dataCache.swf" width="0" height="0" id="flashCache"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="https://login.yahoo.com/login/dataCache.swf?' + ts + '" /> <param name="bgColor" value="#fff" /> </object> ';
376
+
377
+ }
378
+ document.write(flashCode);
379
+
380
+ </script>
381
+
382
+
383
+ <div id="yregct" class="yregclb">
384
+ <div id="yreglg">
385
+ <!-- login box goes here -->
386
+ <div class="top yregbx">
387
+ <script type="text/javascript">if(top == self) { document.write("<div class=\" badge\">")}</script> <span class="ct"><span class="cl"></span></span>
388
+ <div class="yregbxi">
389
+ <script type="text/javascript">if(top == self) { document.write("") } else { top.location.href = "http://www.yahoo.com" }</script> <!-- <p>you need a Yahoo! ID.</p> -->
390
+ <div class="yregdsilu">
391
+ <h2 class="yregdnt">Don't have a Yahoo! ID?</h2>
392
+ <p class="yregsueasy">Signing up is easy.</p>
393
+ <p class="yreglgsut"><a href="https://edit.yahoo.com/config/eval_register?.intl=us&new=1&.done=http%3A//my.yahoo.com&.src=&.v=0&.u=5nb76854mckbd&partner=&.partner=&pkg=&stepid=&.p=&promo=&.last=">Sign Up</a></p>
394
+ </div>
395
+ <h2>Already have a Yahoo! ID?</h2>
396
+ <p>Sign in.</p>
397
+
398
+ <script type="text/javascript">if (top == self) { document.write(" <div id=\"rcta\"> <a href=\"https://protect.login.yahoo.com/login/set_pref?.intl=us&.src=&.u=5nb76854mckbd&.partner=&pkg=&stepid=&.pd=c=&.crumb=czozMjoiZGI2ZmQxOTFhODMyM2M4MDI4ZjNlOTVhZGIzZGIxNDYiOw--&.done=https%3A%2F%2Flogin.yahoo.com%2Fconfig%2Flogin%3F\" tabIndex=\"-1\"> <a href=\"https://protect.login.yahoo.com/login/set_pref?.intl=us&.src=&.u=5nb76854mckbd&.partner=&pkg=&stepid=&.pd=c=&.crumb=czozMjoiZGI2ZmQxOTFhODMyM2M4MDI4ZjNlOTVhZGIzZGIxNDYiOw--&.done=https%3A%2F%2Flogin.yahoo.com%2Fconfig%2Flogin%3F\" tabIndex=\"-1\"> <span class=\"ct\"> <span class=\"cl\"></span> </span> </a> <div class=\"ctact\"> <a href=\"https://protect.login.yahoo.com/login/set_pref?.intl=us&.src=&.u=5nb76854mckbd&.partner=&pkg=&stepid=&.pd=c=&.crumb=czozMjoiZGI2ZmQxOTFhODMyM2M4MDI4ZjNlOTVhZGIzZGIxNDYiOw--&.done=https%3A%2F%2Flogin.yahoo.com%2Fconfig%2Flogin%3F\" tabIndex=\"-1\"> <div class=\"key\"> </div> </a> <div class=\"txt\"> <a href=\"https://protect.login.yahoo.com/login/set_pref?.intl=us&.src=&.u=5nb76854mckbd&.partner=&pkg=&stepid=&.pd=c=&.crumb=czozMjoiZGI2ZmQxOTFhODMyM2M4MDI4ZjNlOTVhZGIzZGIxNDYiOw--&.done=https%3A%2F%2Flogin.yahoo.com%2Fconfig%2Flogin%3F\"> <span class=\"qs\">Are you protected?</span> </a> <div class=\"sltxt\"> <a href=\"https://protect.login.yahoo.com/login/set_pref?.intl=us&.src=&.u=5nb76854mckbd&.partner=&pkg=&stepid=&.pd=c=&.crumb=czozMjoiZGI2ZmQxOTFhODMyM2M4MDI4ZjNlOTVhZGIzZGIxNDYiOw--&.done=https%3A%2F%2Flogin.yahoo.com%2Fconfig%2Flogin%3F\"> <span class=\"sl\">Create your sign-in seal.</span> </a> <span class=\"why\">(<a href=\"https://protect.login.yahoo.com/?.src=&.v=0&.u=5nb76854mckbd&.last=&promo=&.intl=us&.bypass=&.help=3&.partner=&pkg=&stepid=&.pd=_ver%3d0%2526c=&.done=http%3A//my.yahoo.com\">Why?</a>)</span> </div> </div> </div> <a href=\"https://protect.login.yahoo.com/login/set_pref?.intl=us&.src=&.u=5nb76854mckbd&.partner=&pkg=&stepid=&.pd=c=&.crumb=czozMjoiZGI2ZmQxOTFhODMyM2M4MDI4ZjNlOTVhZGIzZGIxNDYiOw--&.done=https%3A%2F%2Flogin.yahoo.com%2Fconfig%2Flogin%3F\" tabIndex=\"-1\"> <span class=\"cb\"> <span class=\"cl\"></span> </span> </a> </a> </div> <div class=\"clear\"> </div>") } else { top.location.href = "http://www.yahoo.com" }</script><div class="yregertxt"><strong>This ID is not yet taken.</strong><br>Are you trying to <a href="http://rd.yahoo.com/reg/login1/tst_pst/suli/signup/us//*https://edit.yahoo.com/config/eval_register?login=noah.box73&.intl=us&.done=http%3A//my.yahoo.com&.src=&.v=0&.u=5nb76854mckbd&partner=&.p=&promo=&.last=&.testid=tst_pst"> register</a> for a new account?</div>
399
+
400
+ <fieldset>
401
+ <legend>Login Form</legend>
402
+ <form method="post" action="https://login.yahoo.com/config/login?" autocomplete="off" name="login_form" onsubmit="return hash2(this)">
403
+ <input type="hidden" name=".tries" value="2">
404
+ <input type="hidden" name=".src" value="">
405
+ <input type="hidden" name=".md5" value="">
406
+ <input type="hidden" name=".hash" value="">
407
+ <input type="hidden" name=".js" value="">
408
+ <input type="hidden" name=".last" value="">
409
+ <input type="hidden" name="promo" value="">
410
+ <input type="hidden" name=".intl" value="us">
411
+ <input type="hidden" name=".bypass" value="">
412
+ <input type="hidden" name=".partner" value="">
413
+ <input type="hidden" name=".u" value="5nb76854mckbd">
414
+ <input type="hidden" name=".v" value="0">
415
+ <input type="hidden" name=".challenge" value="hGeF8WHIzeXmglojwimZrAqqtk02">
416
+ <input type="hidden" name=".yplus" value="">
417
+ <input type="hidden" name=".emailCode" value="">
418
+ <input type="hidden" name="pkg" value="">
419
+ <input type="hidden" name="stepid" value="">
420
+ <input type="hidden" name=".ev" value="">
421
+ <input type="hidden" name="hasMsgr" value="0">
422
+ <input type="hidden" name=".chkP" value="Y">
423
+ <input type="hidden" name=".done" value="http://my.yahoo.com">
424
+ <input type="hidden" name=".pd" value="_ver=0&c=&ivt=&sg=">
425
+ <table id="yreglgtb" summary="form: login information" cellspacing="0" cellpadding="0">
426
+ <tr>
427
+ <th><label for="username">Yahoo! ID:</label></th></tr>
428
+ <tr>
429
+ <td><input name="login" id="username" value="" size="17" class="yreg_ipt" type="text" maxlength="96">
430
+ <script language="JavaScript" type="text/javascript">if(document.getElementById) document.getElementById('username').focus();</script>
431
+
432
+ <div class="dbidTip">(e.g. free2rhyme@yahoo.com)</div>
433
+ </td>
434
+ </tr>
435
+ <tr>
436
+ <th><label for="passwd">Password:</label></th></tr>
437
+ <tr>
438
+ <td><input name="passwd" id="passwd" value="" size="17" class="yreg_ipt" type="password" maxlength="64"></td>
439
+ </tr>
440
+
441
+
442
+
443
+ </table>
444
+
445
+ <p id="sigcopys"><input type="checkbox" id="persistent" name=".persistent" value="y"
446
+ >
447
+ <label for="persistent"> <span class="kmsibold">Keep me signed in</span><br><span class="subperstxt">for 2 weeks unless I sign out.</span> <em class="nwred"><a href="http://us.rd.yahoo.com/reg/login1/suli/pst_help/us//*https://login.yahoo.com/config/login?.src=&.intl=us&.help=4&.v=0&.u=5nb76854mckbd&.last=&promo=&.bypass=&.partner=&pkg=&stepid=&.pd=_ver%253D0%2526c%253D%2526ivt%253D%2526sg%253D&.ab=&.done=http%3A//my.yahoo.com" tabindex="99999">Info</a></em></label>
448
+ <span class="subperstxt2">[Uncheck if on a shared computer]</span>
449
+ </p>
450
+ <div class="clear"></div>
451
+ <p class="yreglgsb"><input type="submit" name=".save" value="Sign In"></p>
452
+ </form>
453
+ </fieldset>
454
+ <a href="http://us.rd.yahoo.com/reg/login1/suli/forgot_lib/us//*https://edit.yahoo.com/config/eval_forgot_pw?new=1&.done=http%3A//my.yahoo.com&.src=&partner=&.intl=us&pkg=&stepid=&.pd=_ver%3d0%26c=&.ab=&.last=">Forget your ID or password?</a> | <a href="http://us.rd.yahoo.com/reg/login1/suli/sih_lib/us//*https://login.yahoo.com/config/login?.src=&.intl=us&.help=1&.v=0&.u=5nb76854mckbd&.last=&.last=&promo=&.bypass=&.partner=&pkg=&stepid=&.pd=_ver%253D0%2526c%253D%2526ivt%253D%2526sg%253D&.ab=&.done=http%3A//my.yahoo.com">Help</a>
455
+ </p>
456
+
457
+ </div>
458
+ <span class="cb"><span class="cl"></span></span>
459
+ <script type="text/javascript">document.write("</div>")</script>
460
+ </div>
461
+
462
+ <!-- end login box -->
463
+ </div>
464
+ <div id="yregtxt">
465
+ <!-- begin left side content -->
466
+
467
+ <div id="yreghtxt">
468
+ <h2>Try the following hints.</h2>
469
+ <ul class="yregbpt">
470
+ <li>
471
+ <h3>Is the "Caps Lock" or "A" light on your keyboard on?</h3>
472
+ <cite>If so, hit "Caps Lock" key before trying again.</cite></li>
473
+ <li><h3>Did you forget or misspell your ID or password?</h3>
474
+ <cite>You can <a class="links" href="https://edit.yahoo.com/config/eval_forgot_pw?new=1&.src=&.intl=us&.u=5nb76854mckbd&.v=0&.partner=&.done=http%3A//my.yahoo.com&.last="> recover your ID and/or password</a> by confirming your private information.</cite></li>
475
+ <li><h3>Still having trouble?</h3>
476
+ <cite>Try <a class="links" href="https://login.yahoo.com/config/login?new=1&.src=&.intl=us&.help=1&.u=5nb76854mckbd&.v=0&.partner=&.done=http%3A//my.yahoo.com&.last=">sign-in help</a>.</cite></li>
477
+ <li><h3>Did you forget to include your full Yahoo! ID?</h3>
478
+ <cite>If so, please remember to use your full Yahoo! ID (e.g. free2rhyme@yahoo.com) to sign in.</cite></li>
479
+ </ul>
480
+ </div>
481
+ <!-- Content module end -->
482
+
483
+ <!-- end left side content -->
484
+ </div>
485
+ </div>
486
+ <!-- begin footer -->
487
+
488
+ <div id="yregft">
489
+ <p>Copyright &copy; 2009 Yahoo! Inc. All rights reserved. <a href="http://docs.yahoo.com/info/copyright/copyright.html" target="cp">Copyright/IP Policy</a> | <a href="http://docs.yahoo.com/info/terms/" target="tos">Terms of Service</a> | <a href="http://security.yahoo.com/" target="sc">Guide to Online Security</a></p>
490
+ <p>
491
+ Relevant advertising creates a better web experience. <a href='http://info.yahoo.com/relevantads/' target='_blank'>See how</a>
492
+ </p>
493
+ <p>NOTICE: We collect personal information on this site.</p>
494
+ <p>To learn more about how we use your information, see our <a href="http://privacy.yahoo.com/" target="_new" title="Click here to view Yahoo! Privacy Policy">Privacy Policy</a></p>
495
+ </div>
496
+
497
+
498
+ <!-- end footer -->
499
+ </div>
500
+ </div>
501
+ <script type="text/javascript">
502
+ if (top != self) top.location.href = location.href;
503
+
504
+ </script>
505
+ <script type="text/javascript">
506
+ <!--
507
+ browser_string = navigator.appVersion + " " + navigator.userAgent;
508
+ if ( browser_string.indexOf("MSIE") < 0 ) {
509
+ if (navigator.mimeTypes) {
510
+ for (i = 0 ; i < navigator.mimeTypes.length ; i++) {
511
+ if (navigator.mimeTypes[i].suffixes.indexOf("yps") > -1) {
512
+ doGotIt();
513
+ }
514
+ }
515
+ } else {
516
+ dontGotIt();
517
+ }
518
+ } else {
519
+ if (browser_string.indexOf("Windows")>=0) {
520
+ doGotIt();
521
+ document.write('<object classid="clsid:41695A8E-6414-11D4-8FB3-00D0B7730277" CODEBASE="javascript:dontGotIt();" ID="Ymsgr" width="1" height="1">');
522
+ document.write('</object>');
523
+ }
524
+ }
525
+ hasMsgr = 0;
526
+ function dontGotIt(){
527
+ hasMsgr = 0;
528
+ document.login_form.hasMsgr.value=0;
529
+ }
530
+ function doGotIt(){
531
+ hasMsgr = 1;
532
+ document.login_form.hasMsgr.value=1;
533
+ }
534
+ function setFocus() {
535
+ var aAcceptableInputTypes = Array("checkbox", "password", "radio", "select-one", "select-multiple", "text", "textarea");
536
+ curEl = document.login_form.login;
537
+ curElType = curEl.type;
538
+ /* focus first form input element */
539
+ if (aAcceptableInputTypes.inArray(curElType)) {
540
+ curEl.focus();
541
+ } else {
542
+ document.login_form.passwd.focus();
543
+ }
544
+ }
545
+ Array.prototype.inArray = function (value) {
546
+ /* for each element in the array */
547
+ for (var idx = 0; idx < this.length; idx++) {
548
+ /* compare requested value with the current element. Match identical (===), not just similar (==) */
549
+ if (this[idx] === value) { // it is the same
550
+ return true;
551
+ }
552
+ }
553
+ /* not found */
554
+ return false;
555
+ };
556
+ //-->
557
+ </script>
558
+ <script src="https://a248.e.akamai.net/sec.yimg.com/lib/reg/js/login_md5_1_14.js" type="text/javascript"></script>
559
+
560
+ <!-- spaceid: 150001456 INT.OFFSET: 0 --><!-- SpaceID=150001456 loc=FR01 noad -->
561
+ <!-- SpaceID=150001456 loc=SIP noad -->
562
+ <script language=javascript>
563
+ if(window.yzq_d==null)window.yzq_d=new Object();
564
+ window.yzq_d['AWR4xkLEYrQ-']='&U=12brleg8m%2fN%3dAWR4xkLEYrQ-%2fC%3d-1%2fD%3dSIP%2fB%3d-1%2fV%3d0';
565
+ </script><noscript><img width=1 height=1 alt="" src="https://us.bc.yahoo.com/b?P=NjdtaEWTcKBJaBHvSWZRbQH3QsAi8ElmUW0ACmVV&T=1530fcbu0%2fX%3d1231442285%2fE%3d150001456%2fR%3dregst%2fK%3d5%2fV%3d2.1%2fW%3dH%2fY%3dYAHOO%2fF%3d1147364700%2fH%3dc2VjdXJlPXRydWUgc2VjdXJlPVwidFwi%2fQ%3d-1%2fS%3d1%2fJ%3d83F18E44&U=12brleg8m%2fN%3dAWR4xkLEYrQ-%2fC%3d-1%2fD%3dSIP%2fB%3d-1%2fV%3d0"></noscript><!-- l04.member.re3.yahoo.com Thu Jan 8 11:18:05 PST 2009 -->
566
+ </body>
567
+ </html>
568
+ <script language=javascript>
569
+ if(window.yzq_p==null)document.write("<scr"+"ipt language=javascript src=https://a248.e.akamai.net/sec.yimg.com/lib/bc/bc_2.0.4.js></scr"+"ipt>");
570
+ </script><script language=javascript>
571
+ if(window.yzq_p)yzq_p('P=NjdtaEWTcKBJaBHvSWZRbQH3QsAi8ElmUW0ACmVV&T=14um166q6%2fX%3d1231442285%2fE%3d150001456%2fR%3dregst%2fK%3d5%2fV%3d1.1%2fW%3dJ%2fY%3dYAHOO%2fF%3d1391850909%2fH%3dc2VjdXJlPXRydWUgc2VjdXJlPVwidFwi%2fS%3d1%2fJ%3d83F18E44');
572
+ if(window.yzq_s)yzq_s();
573
+ </script><noscript><img width=1 height=1 alt="" src="https://us.bc.yahoo.com/b?P=NjdtaEWTcKBJaBHvSWZRbQH3QsAi8ElmUW0ACmVV&T=152htfsgh%2fX%3d1231442285%2fE%3d150001456%2fR%3dregst%2fK%3d5%2fV%3d3.1%2fW%3dJ%2fY%3dYAHOO%2fF%3d923619664%2fH%3dc2VjdXJlPXRydWUgc2VjdXJlPVwidFwi%2fQ%3d-1%2fS%3d1%2fJ%3d83F18E44"></noscript>
574
+ <!-- l04.member.re3.yahoo.com uncompressed/chunked Thu Jan 8 11:18:05 PST 2009 -->
@@ -0,0 +1,53 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ context "The Freenet importer" do
4
+
5
+ setup do
6
+ @username, @password = GraybookExtensions::TestHelper::Credentials.new(:freenet).get
7
+
8
+ @importer = Graybook::Importer::Freenet.new
9
+ @importer.create_agent
10
+ end
11
+
12
+ specify "should match emails" do
13
+ @importer.=~(nil).should.not.be
14
+ @importer.=~({}).should.not.be
15
+ @importer.=~({ 'username' => "john@foo.com" }).should.not.be
16
+ @importer.=~({ :username => "john@foo.com" }).should.not.be
17
+ @importer.=~({ :username => "john" }).should.not.be
18
+ @importer.=~({ :username => "john@freenet.de" }).should.be
19
+ @importer.=~({ :username => "JOHN@FREENET.DE" }).should.be
20
+ end
21
+
22
+ specify "should be able to login with correct credentials" do
23
+ should.not.raise Exception do
24
+ login(@username, @password)
25
+ end
26
+ end
27
+
28
+ specify "should raise BadCredentialsError on login with wrong credentials" do
29
+ should.raise Graybook::BadCredentialsError do
30
+ login
31
+ end
32
+ end
33
+
34
+ specify "should raise BadCredentialsError on login with correct username and wrong password" do
35
+ should.raise Graybook::BadCredentialsError do
36
+ login(@username)
37
+ end
38
+ end
39
+
40
+ specify "should able to get contacts" do
41
+ login(@username, @password)
42
+
43
+ contacts = @importer.scrape_contacts
44
+ contacts.should.not.be.empty
45
+ contacts.should.be.all { |contact| contact.is_a? Hash }
46
+ end
47
+
48
+ private
49
+ def login(username = "foo", password = "bar")
50
+ @importer.options = { :username => username, :password => password }
51
+ @importer.login
52
+ end
53
+ end