Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
- <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">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="Generator" content="Microsoft Word 12 (filtered medium)">
- <!--[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>
- <!--[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]-->
- </head>
- <body lang="EN-US" link="blue" vlink="purple">
- <div class="WordSection1">
- <p class="MsoNormal"><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><p> </p></span></p>
- <p class="MsoNormal"><a name="_MailEndCompose"><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><p> </p></span></a></p>
- <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>
- label_tag_name = 'div div p span br b'
- if label_tag = @doc.at_css(%Q{#{label_tag_name}:contains("#{label}:")})
- @attributes[field] = label_tag.text.gsub("#{label}:",'').gsub("\n", "").strip
- end
- <div>
- <div>
- <p>
- <b>
- <span>From:</span>
- </b>
- <span> 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>
- date_string = @doc.at_css('div div p>span b').next
- date_string = @doc.css('div div p>span b')[0].next
- to_string = @doc.css('div div p>span b')[1].next
- subject_string = @doc.css('div div p>span b')[2].next
- > doc.css("div.WordSection1 p.MsoNormal span").text[/Sent:n(.*)/, 1]
- => " !! DATE I NEED TO GRAB HERE !! To:"
- require 'nokogiri'
- doc = Nokogiri::HTML(<<EOT)
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <div class="WordSection1">
- <div>
- <div>
- <b>Sent:</b>!! DATE I NEED TO GRAB HERE !!<br>
- <b>To:</b> EMAIL ADDRESS HERE<br>
- <b>Subject:</b> SUBJECT LINE HERE</span></p>
- </div>
- </div>
- </div>
- </body>
- </html>
- EOT
- text = doc.at('div.WordSection1').text
- sent_date = text[/Sent:(.+)To:/, 1].strip
- puts sent_date
- !! DATE I NEED TO GRAB HERE !!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement