Advertisement
Guest User

Untitled

a guest
May 17th, 2013
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  2. <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta name="Generator" content="Microsoft Word 12 (filtered medium)">
  6. <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}no\:* {behavior:url(#default#VML);}nw\:* {behavior:url(#default#VML);}n.shape {behavior:url(#default#VML);}n</style><![endif]--><style><!--n/* Font Definitions */n@font-facent{font-family:"Cambria Math";ntpanose-1:2 4 5 3 5 4 6 3 2 4;}n@font-facent{font-family:Calibri;ntpanose-1:2 15 5 2 2 2 4 3 2 4;}n@font-facent{font-family:Tahoma;ntpanose-1:2 11 6 4 3 5 4 4 2 4;}n/* Style Definitions */np.MsoNormal, li.MsoNormal, div.MsoNormalnt{margin:0in;ntmargin-bottom:.0001pt;ntfont-size:12.0pt;ntfont-family:"Times New Roman","serif";}na:link, span.MsoHyperlinknt{mso-style-priority:99;ntcolor:blue;nttext-decoration:underline;}na:visited, span.MsoHyperlinkFollowednt{mso-style-priority:99;ntcolor:purple;nttext-decoration:underline;}npnt{mso-style-priority:99;ntmso-margin-top-alt:auto;ntmargin-right:0in;ntmso-margin-bottom-alt:auto;ntmargin-left:0in;ntfont-size:12.0pt;ntfont-family:"Times New Roman","serif";}nspan.EmailStyle18nt{mso-style-type:personal-reply;ntfont-family:"Calibri","sans-serif";ntcolor:#1F497D;}n.MsoChpDefaultnt{mso-style-type:export-only;ntfont-size:10.0pt;}n@page WordSection1nt{size:8.5in 11.0in;ntmargin:1.0in 1.0in 1.0in 1.0in;}ndiv.WordSection1nt{page:WordSection1;}n--> </style>
  7. <!--[if gte mso 9]><xml>n<o:shapedefaults v:ext="edit" spidmax="1026" />n</xml><![endif]--> <!--[if gte mso 9]> <xml>n<o:shapelayoutv:ext="edit">n<o:idmapv:ext="edit"data="1"/>n</o:shapelayout></xml><![endif]-->
  8.  
  9. </head>
  10. <body lang="EN-US" link="blue" vlink="purple">
  11. <div class="WordSection1">
  12. <p class="MsoNormal"><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><p>&nbsp;</p></span></p>
  13. <p class="MsoNormal"><a name="_MailEndCompose"><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><p>&nbsp;</p></span></a></p>
  14. <div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> EMAIL SENDER NAME [mailto:EMAILADDRESS@FAKE.COM] <br><b>Sent:</b>!! DATE I NEED TO GRAB HERE !! <br><b>To:</b> EMAIL ADDRESS HERE <br><b>Subject:</b> SUBJECT LINE HERE <p></p></span></p></div></div>
  15.  
  16. label_tag_name = 'div div p span br b'
  17. if label_tag = @doc.at_css(%Q{#{label_tag_name}:contains("#{label}:")})
  18. @attributes[field] = label_tag.text.gsub("#{label}:",'').gsub("\n", "").strip
  19. end
  20.  
  21. <div>
  22. <div>
  23. <p>
  24. <b>
  25. <span>From:</span>
  26. </b>
  27. <span> EMAIL SENDER NAME [mailto:EMAILADDRESS@FAKE.COM] <br>
  28. <b>Sent:</b>!! DATE I NEED TO GRAB HERE !! <br>
  29. <b>To:</b> EMAIL ADDRESS HERE <br>
  30. <b>Subject:</b> SUBJECT LINE HERE <p></p>
  31. </span></p></div></div>
  32.  
  33. date_string = @doc.at_css('div div p>span b').next
  34.  
  35. date_string = @doc.css('div div p>span b')[0].next
  36. to_string = @doc.css('div div p>span b')[1].next
  37. subject_string = @doc.css('div div p>span b')[2].next
  38.  
  39. > doc.css("div.WordSection1 p.MsoNormal span").text[/Sent:n(.*)/, 1]
  40. => " !! DATE I NEED TO GRAB HERE !! To:"
  41.  
  42. require 'nokogiri'
  43.  
  44. doc = Nokogiri::HTML(<<EOT)
  45. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  46. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  47.  
  48. <html>
  49. <head>
  50. <title></title>
  51. </head>
  52.  
  53. <body>
  54. <div class="WordSection1">
  55.  
  56. <div>
  57. <div>
  58. <b>Sent:</b>!! DATE I NEED TO GRAB HERE !!<br>
  59. <b>To:</b> EMAIL ADDRESS HERE<br>
  60. <b>Subject:</b> SUBJECT LINE HERE</span></p>
  61. </div>
  62. </div>
  63. </div>
  64. </body>
  65. </html>
  66. EOT
  67.  
  68. text = doc.at('div.WordSection1').text
  69. sent_date = text[/Sent:(.+)To:/, 1].strip
  70. puts sent_date
  71.  
  72. !! DATE I NEED TO GRAB HERE !!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement