首页 > 解决方案 > 如何使用 JavaScript 从页面内容中获取特定行

问题描述

我正在从事一项对我来说非常困难的任务。看看附件中的内容,它包含一封邀请人们投标项目的电子邮件。我的任务是获取 (1) 公司名称及其徽标(如果可能)(2)根据电子邮件中所述的项目的高露日期(3)项目的位置哪个项目或公司..我要用JavaScript来做这个,我不知道使用什么功能,因为我以前从未这样做过.. 请感谢您的贡献和想法.. 在此先感谢.. 编辑:为了让你们理解我的意思.. 我已经包含了页面内容的屏幕截图。 . 如图所示..这主要是电子邮件内容的外观..电子邮件将来自许多来源。我的任务是从电子邮件的内容中获取 (1) 露水日期 (2) 公司名称 (3) 位置。我不知道该怎么做,但我相信这是可能的。谢谢你回复.. 在此处输入图像描述

    <div dir="auto"></div><br><div><div dir="ltr">---------- Forwarded message ---------<br>From: <strong dir="auto">R&amp;O Construction Brady Hill</strong> <span dir="ltr">&lt;<a href="mailto:email@com2.smartbidnet.com">email@com2.smartbidnet.com</a>&gt;</span><br>Date: Thu, Mar 28, 2019, 2:30 PM<br>Subject: Olympus Hills Retail Center Exterior Renovation, Salt Lake City Invitation<br>To:  &lt;<a href="mailto:email@lonepeakmasonry.com">email@lonepeakmasonry.com</a>&gt;<br></div><br><br><img src="https://secure.smartbidnet.com/External/RequestReadReceipt.aspx?sCommunicationId=650105303&amp;oimg=1x1pic.gif" height="1" width="1">
<div style="width:100%"><table style="FONT-SIZE:11px;FONT-FAMILY:Verdana" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr><td align="left"><div align="center"><a href="https://secure.smartbidnet.com/Main/Login.aspx?cId=bp_650105303&amp;sPassportKey=AA8D9C40EFA9643F173D40DD3EC0E0C1DFE05F39&amp;sBidId=437879&amp;st=101&amp;e=1" target="_blank" rel="noreferrer"><img align="left" src="https://secure.smartbidnet.com/ImagesAtProject/Icons/ClickHereBids-US.gif" border="0" width="457" height="56">
</a></div>
</td></tr>
<tr><td><font style="FONT-SIZE:12px;FONT-FAMILY:Arial">
If this link does not work, please go to <a href="https://secure.smartbidnet.com/LRCD?st=102" target="_blank" rel="noreferrer">https://secure.smartbidnet.com/LRCD</a> and enter the access key: 61f1868937df162
</font></td></tr>
<tr><td><a href="https://secure.smartbidnet.com/Main/Login.aspx?cId=bp_650105303&amp;sPassportKey=AA8D9C40EFA9643F173D40DD3EC0E0C1DFE05F39&amp;sBidId=437879&amp;iR=1&amp;st=103&amp;e=1" style="font-weight:bold;color:#ff6f02;font-size:12px" target="_blank" rel="noreferrer">Yes, I&#39;ll Bid All Codes</a>
<font style="font-weight:bold;color:#ff6f02;font-size:12px"> |Â </font><a href="https://secure.smartbidnet.com/Main/Login.aspx?cId=bp_650105303&amp;sPassportKey=AA8D9C40EFA9643F173D40DD3EC0E0C1DFE05F39&amp;sBidId=437879&amp;iR=0&amp;st=104&amp;e=1" style="font-weight:bold;color:#ff6f02;font-size:12px" target="_blank" rel="noreferrer">No, I Won&#39;t Bid this Job</a>
<font style="font-weight:bold;color:#ff6f02;font-size:12px"> |Â </font><a href="https://secure.smartbidnet.com/Main/Login.aspx?cId=bp_650105303&amp;sPassportKey=AA8D9C40EFA9643F173D40DD3EC0E0C1DFE05F39&amp;sBidId=437879&amp;st=105&amp;e=1" style="font-weight:bold;color:#ff6f02;font-size:12px" target="_blank" rel="noreferrer">Click Here to View the Project</a>
</td></tr>
</table><br><br>
<font style="FONT-SIZE:11px;FONT-FAMILY:Verdana"><h1 style="text-align:left">
<span style="font-size:x-large">
<span style="font-size:large">
<span style="font-size:x-large">
<span style="font-size:x-small">
Lone Peak Masonry (Draper, UT)

<br>Attention: 
Dave
 
Smith
</span>
<br></span>
<span style="font-size:x-large">Â 
<br></span></span></span></h1>
<h1 style="text-align:center">
<span style="font-size:x-large">R&amp;O Construction
<br>Invites You To Bid With Us</span></h1>

<table style="width:544px;height:147px;text-align:center" border="0" align="center">
<tbody>
<tr>

<td style="text-align:left"><address>
<span style="font-size:x-small">Corporate Office
<br>933 Wall Ave.
<br>Ogden, UT
<br>84404
<br>P) phone Number
<br>F) Phone Number
<br></span></address></td>

<td>

<p><img src="https://secure.smartbidnet.com/Files/System_1064/images/Blue%20Logo(1).png" width="148" height="132">
<br>
<br><a href="http://www.randoco.com" target="_blank" rel="noreferrer">
<span style="font-size:xx-small">www.randoco.com</span></a></p>
</td>

<td><address style="text-align:right">
<span style="font-size:x-small">
<br>
<br>1743 W Alexander Street
<br>Suite #100
<br>West Valley City, UT
<br>84119
<br>P) 801-532-0123
<br>
<br>Â Â 
<br></span></address></td>
</tr>
</tbody>
</table>

<table style="width:100%;text-align:center" border="0">
<tbody>
<tr>

<td>Â </td>
</tr>
<tr>

<td>

<p style="text-align:center">
<span style="font-size:x-large">
<strong>
Olympus Hills Retail Center Exterior Renovation, Salt Lake City
</strong></span></p>
</td>
</tr>
<tr>

<td>

<p style="text-align:center">
<span style="font-size:large">
3979 South Wasatch Blvd.  - Salt Lake City, UT 84124-
</span></p>
</td>
</tr>
<tr>

<td>Â </td>
</tr>
<tr>

<td>

<p style="text-align:center">
<span style="font-size:large">
<strong>BIDS ARE DUE: 
April 17, 2019 03:00 PM
 
(MT)
</strong></span></p>
</td>
</tr>
</tbody>
</table>

<table style="width:100%;height:67px;text-align:center" border="0">
<tbody>
<tr>

<td>Â </td>
</tr>
<tr>

<td>

<p style="text-align:center">
<span style="font-size:medium">

<div style="text-align:center">
<span style="font-family:times new roman,times,serif;font-size:14pt">Exterior Façade and Hardscape Remodel of the Olympus Hills Retail Center.
<br>
<br>Contractors are encouraged to visit the site prior to submitting their bids.
<br>
<br>Please submit your proposal through SmartBid, by email to Brady Hill, Estimator, <a href="mailto:email@randoco.com" target="_blank" rel="noreferrer">email@randoco.com</a> or by fax to our Ogden Office Number.
<br>
<br>Bid Documents are also available on our website @ <a href="http://www.randoco.com" target="_blank" rel="noreferrer">www.randoco.com</a>.
<br>
<br>Thank you for bidding with R&amp;O Construction.
<br></span></div>
</span></p>
</td>
</tr>
<tr>

<td>Â </td>
</tr>
</tbody>
</table>

<table style="width:783px;height:75px;text-align:center" border="0">
<tbody>

<tr style="text-align:center" valign="bottom">

<td>
<span style="font-size:medium">
<span style="text-decoration:underline">Contact:</span></span></td>

<td>Â </td>

<td>
<span style="font-size:medium">
<span style="text-decoration:underline">Email:</span></span></td>

<td>Â </td>

<td>
<span style="font-size:medium">
<span style="text-decoration:underline">Phone:</span></span></td>

<td>Â </td>

<td>
<span style="font-size:medium">
<span style="text-decoration:underline">Fax:</span></span></td>
</tr>

<tr style="text-align:center" valign="top">

<td>
<span style="font-size:medium">Brady Hill</span></td>

<td>Â </td>

<td>
<span style="font-size:medium"><a href="mailto: " target="_blank" rel="noreferrer">email@randoco.com</a></span></td>

<td>Â </td>

<td>
<span style="font-size:medium"> </span></td>

<td>Â </td>

<td>
<span style="font-size:medium"> </span></td>
</tr>
</tbody>
</table>

<table style="width:783px;height:144px;text-align:center" border="0">
<tbody>
<tr>

<td style="text-align:center" valign="bottom"><em>
<span style="font-size:xx-small">Â </span></em></td>
</tr>
<tr>

<td style="text-align:center" valign="bottom"><em>
<span style="font-size:xx-small">Bidders must comply with all City and State Licensing.
<br>
<br>Our Ins. requirements are $1,000,000 per occurrence, $2,000,000 aggregate &amp; $1,000,000 umbrella
<br>Survey subcontractors must have errors and omissions ins. (professional liability ins.).
<br>
<br>R&amp;O Construction is an EEO/AA Employer
<br>
<br>Contracts exceeding $200,000 may be subject to a confidential finance review.</span></em></td>
</tr>
</tbody>
</table>

<table style="width:100%;text-align:center" border="0">
<tbody>
<tr>

<td style="text-align:center" valign="top">
<span style="font-size:xx-small">Utah License #95-292934-5501 ~ Arizona License #079839 ~ Nevada License #0034039</span></td>
</tr>
<tr>

<td style="text-align:center" valign="top">
<span style="font-size:xx-small">California License #604354 d.b.a. ROCON COMPANY</span></td>
</tr>
<tr>

<td style="text-align:center" valign="top">
<span style="font-size:xx-small">Washington License #CC01 ROCONC #088RG ~ New Mexico License #031344 ~ Idaho License #10211-AA</span></td>
</tr>
</tbody>
</table>
<hr>

<table style="width:100%;text-align:center" border="0">
<tbody>
<tr>

<td>
<span style="font-size:xx-small">
<br>PLEASE LOGIN USING THE INFORMATION ABOVE TO ACCEPT/REJECT THE INVITE AND TO DOWNLOAD PLANS</span></td>
</tr>
</tbody>
</table>
<h1 style="text-align:center">
<br>
<br></h1></font>
<br><br>Â </div><div style="clear:both"></div><div>To Unsubscribe from receiving invitations, please <a href="https://secure.smartbidnet.com/External/Unsubscribe.aspx?DId=650105303&amp;PId=11151969&amp;CType=1&amp;st=106&amp;e=1" target="_blank" rel="noreferrer">Click Here</a>
</div>
 <div style="clear:both"></div><div>This is an automated email communication so replies to this address will not be answered.</div>

<img src="http://com2.smartbidnet.com/wf/open?upn=Ec818zpKGhsa3nrt3hc9G59m8rgwdlc1vywQ5NYZFh29X36ieqFQbbB1eQ4xPOWO-2FgC4OOD8kd-2B-2FjPJlecZt-2F6M8KmhcoHSqllBh9WbhzHtcM0wkxmIaspKs48mcpqonKaeL-2FjDx2lOs-2FFp6tpGe-2FTMErp1bqHae6GZ3vPk9Qt6zoxRiAMslZiJ1ZtX8ev-2FeBx-2BbWGnB4K5FU0IPE5Rz16Ouuw-2BjY3wGKDr2cchCFa-2BWyuOpUG0ldWPRiFOoc3W2HvIibgrKx1tSQOhzPUYlmMDl-2BfADgOv49bGNy02o-2B11bejm7LLV1tulxKEwIntqlQIz3YExI5xqsuAKxnm4TW4uPfJrlmOT5HTwNWs8NonM-3D" width="1" height="1" border="0" style="height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>

标签: javascriptphp

解决方案


使用DocumentFragmentquerySelectorAll提出了这个解决方案,我以添加自定义解析器的方式编写了解决方案。这可能不是确切的解决方案,但可能会给您一些继续前进的方向。

const DataParser = (function DataParser() {
  function Parser(inputStr) {
    this.input = inputStr;
    // creates a fragemet
    this.fragment = document.createRange().createContextualFragment(inputStr);
  }

  Parser.prototype.parse = function(parsers) {
    parsers = typeof parsers === 'string' ? [parsers] : parsers;

    return parsers.reduce((output, parser) => {
      output[parser] = this[parser] && this[parser]();
      return output;
    }, {});
  };

  Parser.prototype.selector = function(selector) {
    // converts HTMLCollection to Array
    return [].slice.call(this.fragment.querySelectorAll(selector));
  };

  Parser.prototype.contains = function(selector, text) {
    // select elements containing particular text
    return this.selector(selector).filter((element) => {
      return RegExp(text).test(element.textContent);
    });
  };

  Parser.prototype.address = function() {
    return this.selector('address')
      .map(address => {
        return address.textContent
          // removes phone and fax contents
          .split(/\P\)/)[0].trim().replace(/\n/g, ', ');
      });
  };

  Parser.prototype.email = function() {
    return this.selector('a[href^="mailto:"]').map(a => a.textContent.trim());
  };

  Parser.prototype.image = function() {
    return this.selector('img').map(img => img.src);
  };

  return {
    create: (input) => new Parser(input),
    parse: (input, selectors) => (new Parser(input)).parse(selectors),
    add: function(name, parser) {
      Parser.prototype[name] = function(...args) {
        return parser.apply(this, [this, ...args]);
      };
    }
  };
})();

// custom parsers
DataParser.add('logo', (parserContext) => {
  return parserContext.image()
    .filter(img => img.toLowerCase().includes('logo'))[0];
});


DataParser.add('companyName', (parserContext) => {
  return parserContext.selector('h1')
    .map(el => {
      return el.textContent.trim().split('\n')[0];
    })[1];
});


DataParser.add('dueDate', (parserContext) => {
  return parserContext.contains('strong', 'BIDS ARE DUE:')
    .map(el => {
      const date = el.textContent.split(':')[1];
      return date && date.trim();
    })[0];
});




const input = `<div dir="auto"></div><br><div><div dir="ltr">---------- Forwarded message ---------<br>From: <strong dir="auto">R&amp;O Construction Brady Hill</strong> <span dir="ltr">&lt;<a href="mailto:email@com2.smartbidnet.com">email@com2.smartbidnet.com</a>&gt;</span><br>Date: Thu, Mar 28, 2019, 2:30 PM<br>Subject: Olympus Hills Retail Center Exterior Renovation, Salt Lake City Invitation<br>To:  &lt;<a href="mailto:email@lonepeakmasonry.com">email@lonepeakmasonry.com</a>&gt;<br></div><br><br><img src="https://secure.smartbidnet.com/External/RequestReadReceipt.aspx?sCommunicationId=650105303&amp;oimg=1x1pic.gif" height="1" width="1">
<div style="width:100%"><table style="FONT-SIZE:11px;FONT-FAMILY:Verdana" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr><td align="left"><div align="center"><a href="https://secure.smartbidnet.com/Main/Login.aspx?cId=bp_650105303&amp;sPassportKey=AA8D9C40EFA9643F173D40DD3EC0E0C1DFE05F39&amp;sBidId=437879&amp;st=101&amp;e=1" target="_blank" rel="noreferrer"><img align="left" src="https://secure.smartbidnet.com/ImagesAtProject/Icons/ClickHereBids-US.gif" border="0" width="457" height="56">
</a></div>
</td></tr>
<tr><td><font style="FONT-SIZE:12px;FONT-FAMILY:Arial">
If this link does not work, please go to <a href="https://secure.smartbidnet.com/LRCD?st=102" target="_blank" rel="noreferrer">https://secure.smartbidnet.com/LRCD</a> and enter the access key: 61f1868937df162
</font></td></tr>
<tr><td><a href="https://secure.smartbidnet.com/Main/Login.aspx?cId=bp_650105303&amp;sPassportKey=AA8D9C40EFA9643F173D40DD3EC0E0C1DFE05F39&amp;sBidId=437879&amp;iR=1&amp;st=103&amp;e=1" style="font-weight:bold;color:#ff6f02;font-size:12px" target="_blank" rel="noreferrer">Yes, I&#39;ll Bid All Codes</a>
<font style="font-weight:bold;color:#ff6f02;font-size:12px"> |Â </font><a href="https://secure.smartbidnet.com/Main/Login.aspx?cId=bp_650105303&amp;sPassportKey=AA8D9C40EFA9643F173D40DD3EC0E0C1DFE05F39&amp;sBidId=437879&amp;iR=0&amp;st=104&amp;e=1" style="font-weight:bold;color:#ff6f02;font-size:12px" target="_blank" rel="noreferrer">No, I Won&#39;t Bid this Job</a>
<font style="font-weight:bold;color:#ff6f02;font-size:12px"> |Â </font><a href="https://secure.smartbidnet.com/Main/Login.aspx?cId=bp_650105303&amp;sPassportKey=AA8D9C40EFA9643F173D40DD3EC0E0C1DFE05F39&amp;sBidId=437879&amp;st=105&amp;e=1" style="font-weight:bold;color:#ff6f02;font-size:12px" target="_blank" rel="noreferrer">Click Here to View the Project</a>
</td></tr>
</table><br><br>
<font style="FONT-SIZE:11px;FONT-FAMILY:Verdana"><h1 style="text-align:left">
<span style="font-size:x-large">
<span style="font-size:large">
<span style="font-size:x-large">
<span style="font-size:x-small">
Lone Peak Masonry (Draper, UT)

<br>Attention: 
Dave
 
Smith
</span>
<br></span>
<span style="font-size:x-large">Â 
<br></span></span></span></h1>
<h1 style="text-align:center">
<span style="font-size:x-large">R&amp;O Construction
<br>Invites You To Bid With Us</span></h1>

<table style="width:544px;height:147px;text-align:center" border="0" align="center">
<tbody>
<tr>

<td style="text-align:left"><address>
<span style="font-size:x-small">Corporate Office
<br>933 Wall Ave.
<br>Ogden, UT
<br>84404
<br>P) phone Number
<br>F) Phone Number
<br></span></address></td>

<td>

<p><img src="https://secure.smartbidnet.com/Files/System_1064/images/Blue%20Logo(1).png" width="148" height="132">
<br>
<br><a href="http://www.randoco.com" target="_blank" rel="noreferrer">
<span style="font-size:xx-small">www.randoco.com</span></a></p>
</td>

<td><address style="text-align:right">
<span style="font-size:x-small">
<br>
<br>1743 W Alexander Street
<br>Suite #100
<br>West Valley City, UT
<br>84119
<br>P) 801-532-0123
<br>
<br>Â Â 
<br></span></address></td>
</tr>
</tbody>
</table>

<table style="width:100%;text-align:center" border="0">
<tbody>
<tr>

<td>Â </td>
</tr>
<tr>

<td>

<p style="text-align:center">
<span style="font-size:x-large">
<strong>
Olympus Hills Retail Center Exterior Renovation, Salt Lake City
</strong></span></p>
</td>
</tr>
<tr>

<td>

<p style="text-align:center">
<span style="font-size:large">
3979 South Wasatch Blvd.  - Salt Lake City, UT 84124-
</span></p>
</td>
</tr>
<tr>

<td>Â </td>
</tr>
<tr>

<td>

<p style="text-align:center">
<span style="font-size:large">
<strong>BIDS ARE DUE: 
April 17, 2019 03:00 PM
 
(MT)
</strong></span></p>
</td>
</tr>
</tbody>
</table>

<table style="width:100%;height:67px;text-align:center" border="0">
<tbody>
<tr>

<td>Â </td>
</tr>
<tr>

<td>

<p style="text-align:center">
<span style="font-size:medium">

<div style="text-align:center">
<span style="font-family:times new roman,times,serif;font-size:14pt">Exterior Façade and Hardscape Remodel of the Olympus Hills Retail Center.
<br>
<br>Contractors are encouraged to visit the site prior to submitting their bids.
<br>
<br>Please submit your proposal through SmartBid, by email to Brady Hill, Estimator, <a href="mailto:email@randoco.com" target="_blank" rel="noreferrer">email@randoco.com</a> or by fax to our Ogden Office Number.
<br>
<br>Bid Documents are also available on our website @ <a href="http://www.randoco.com" target="_blank" rel="noreferrer">www.randoco.com</a>.
<br>
<br>Thank you for bidding with R&amp;O Construction.
<br></span></div>
</span></p>
</td>
</tr>
<tr>

<td>Â </td>
</tr>
</tbody>
</table>

<table style="width:783px;height:75px;text-align:center" border="0">
<tbody>

<tr style="text-align:center" valign="bottom">

<td>
<span style="font-size:medium">
<span style="text-decoration:underline">Contact:</span></span></td>

<td>Â </td>

<td>
<span style="font-size:medium">
<span style="text-decoration:underline">Email:</span></span></td>

<td>Â </td>

<td>
<span style="font-size:medium">
<span style="text-decoration:underline">Phone:</span></span></td>

<td>Â </td>

<td>
<span style="font-size:medium">
<span style="text-decoration:underline">Fax:</span></span></td>
</tr>

<tr style="text-align:center" valign="top">

<td>
<span style="font-size:medium">Brady Hill</span></td>

<td>Â </td>

<td>
<span style="font-size:medium"><a href="mailto: " target="_blank" rel="noreferrer">email@randoco.com</a></span></td>

<td>Â </td>

<td>
<span style="font-size:medium"> </span></td>

<td>Â </td>

<td>
<span style="font-size:medium"> </span></td>
</tr>
</tbody>
</table>

<table style="width:783px;height:144px;text-align:center" border="0">
<tbody>
<tr>

<td style="text-align:center" valign="bottom"><em>
<span style="font-size:xx-small">Â </span></em></td>
</tr>
<tr>

<td style="text-align:center" valign="bottom"><em>
<span style="font-size:xx-small">Bidders must comply with all City and State Licensing.
<br>
<br>Our Ins. requirements are $1,000,000 per occurrence, $2,000,000 aggregate &amp; $1,000,000 umbrella
<br>Survey subcontractors must have errors and omissions ins. (professional liability ins.).
<br>
<br>R&amp;O Construction is an EEO/AA Employer
<br>
<br>Contracts exceeding $200,000 may be subject to a confidential finance review.</span></em></td>
</tr>
</tbody>
</table>

<table style="width:100%;text-align:center" border="0">
<tbody>
<tr>

<td style="text-align:center" valign="top">
<span style="font-size:xx-small">Utah License #95-292934-5501 ~ Arizona License #079839 ~ Nevada License #0034039</span></td>
</tr>
<tr>

<td style="text-align:center" valign="top">
<span style="font-size:xx-small">California License #604354 d.b.a. ROCON COMPANY</span></td>
</tr>
<tr>

<td style="text-align:center" valign="top">
<span style="font-size:xx-small">Washington License #CC01 ROCONC #088RG ~ New Mexico License #031344 ~ Idaho License #10211-AA</span></td>
</tr>
</tbody>
</table>
<hr>

<table style="width:100%;text-align:center" border="0">
<tbody>
<tr>

<td>
<span style="font-size:xx-small">
<br>PLEASE LOGIN USING THE INFORMATION ABOVE TO ACCEPT/REJECT THE INVITE AND TO DOWNLOAD PLANS</span></td>
</tr>
</tbody>
</table>
<h1 style="text-align:center">
<br>
<br></h1></font>
<br><br>Â </div><div style="clear:both"></div><div>To Unsubscribe from receiving invitations, please <a href="https://secure.smartbidnet.com/External/Unsubscribe.aspx?DId=650105303&amp;PId=11151969&amp;CType=1&amp;st=106&amp;e=1" target="_blank" rel="noreferrer">Click Here</a>
</div>
 <div style="clear:both"></div><div>This is an automated email communication so replies to this address will not be answered.</div>

<img src="http://com2.smartbidnet.com/wf/open?upn=Ec818zpKGhsa3nrt3hc9G59m8rgwdlc1vywQ5NYZFh29X36ieqFQbbB1eQ4xPOWO-2FgC4OOD8kd-2B-2FjPJlecZt-2F6M8KmhcoHSqllBh9WbhzHtcM0wkxmIaspKs48mcpqonKaeL-2FjDx2lOs-2FFp6tpGe-2FTMErp1bqHae6GZ3vPk9Qt6zoxRiAMslZiJ1ZtX8ev-2FeBx-2BbWGnB4K5FU0IPE5Rz16Ouuw-2BjY3wGKDr2cchCFa-2BWyuOpUG0ldWPRiFOoc3W2HvIibgrKx1tSQOhzPUYlmMDl-2BfADgOv49bGNy02o-2B11bejm7LLV1tulxKEwIntqlQIz3YExI5xqsuAKxnm4TW4uPfJrlmOT5HTwNWs8NonM-3D" width="1" height="1" border="0" style="height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>`;

const parser = DataParser.create(input);
console.log(parser.parse(['address', 'email', 'logo', 'dueDate', 'companyName']));

// or 

console.log(DataParser.parse(input, ['address', 'email', 'logo', 'dueDate', 'companyName']));


推荐阅读