ICONICO

Discussion Forum

Post Reply in Data Extractor

Post Reply To "JavaScript Help extracting DOM data help requested"

Hi folks,

I'm having trouble extracting data... Please help!

Issues I'm having:

1. I can't figure out how to get Data Extractor to read from a text file created locally (not on a server or domain) containing the URLs to the pages I want to scrape.

2. I'd like the links in the current domain followed.

3. My JavaScript doesn't seem to be working.

I'm trying to get the address data & contact name from this code:

###

<div class="panel-container">
<div class="panel" style="display: block;">
<div class="panel-wrapper">
<!--AGENT INFO-->
<div id="agent-info">
<span class="agent-info-h2">John T. Carmichael&nbsp;</span>
<span class="agent-info"></span>
<div class="clear"></div>
</div>
<!--AGENT INFO-->
<p>
1230 Yahoo Rd Ste A234<br>
Lodi, CA 94515<br>
P: (456) 123-4356<br>
F: (456) 234-5678
</p>
</div>
</div>
</div>

###

and here's the Data Extractor JavaScript I'm using...

###

DataExtractor.SetColumns(2);
DataExtractor.AddHeader(1, 'AgentName');
DataExtractor.AddHeader(2, 'ContactInfo');

var agentName = document.getElementById('agent-info').innerText;

if (agentName.nextSibling && agentName.nextSibling.nodeName == "P") {
        var contactInfo = agentName.nextSibling.innerText;
}

if (contactInfo) {
for (var i=0; i contactInfo.length; i++) {
DataExtractor.StartNewResult();
DataExtractor.AddResult(1, agentName);
DataExtractor.AddResult(2, contactInfo);
//DataExtractor.ShowError(errorText);
}
}

###

Subject

First Name

Last Name

Email Address for reply notifications (optional) - your email will not be visible

Re-enter the text shown in the image
Enter the text shown here below  

Your Message

  Cancel

Our Software Stores

IconicoAccurate Design and Development Software

BitsDuJourDiscount Deal Coupons for Windows and Mac Software Apps

Our Software Services

SoftwareMarketingResourceYou Wrote the Code, Now How do you Sell it?

IcoBlogOur Official Blog

© copyright 2004-2020 Iconico, Inc. Code & Design. All Rights Reserved. Terms & Conditions Privacy Policy Terms of Use