Jump to content
UBot Underground

Can't Scrape Bit Json


Recommended Posts

Hi all
 
I'm trying to parse big json response from API but plugins as JSON Path and JSON Get Value from ExBrowser fails to parse it:
 
371eb98a8bd46e32f1a6ec35393ecb9e.png
aef9d4344c421fbdc253674144b21816.png
 
9b15c345f56e4f7bff19ae477634332b.png
 
Here is JSON https://ghostbin.com/paste/d5kjx please have a look and this is part of code scraping.
 

define setup excel {
    set(#row,0,"Global")
    set table cell(&results,#row,0,"Name")
    set table cell(&results,#row,1,"companyId")
    set table cell(&results,#row,2,"Industry")
    set table cell(&results,#row,3,"Size")
    set table cell(&results,#row,4,"Location")
    set table cell(&results,#row,5,"Keyword")
}
define scrape to excel {
    set(#row,1,"Global")
    load html($plugin function("ExBrowser.dll", "$ExBrowser Document Text"))
    wait(1)
    set table cell(&results,#row,0,$plugin function("JSONpath.dll", "$JSONpath parser", $plugin function("ExBrowser.dll", "$ExBrowser Document Text"), "searchResults[*].name"))
    wait(1)
    increment(#row)
}
Edited by mastercho
Link to post
Share on other sites

I didn't see the attachment but try these:

 

$.searchResults[*].name

or

$..searchResults[*].name

 

Tried both, still getting an error.  I added link with json on it please check thread 

Link to post
Share on other sites

All the three works:

$.searchResults.[name]
$.searchResults[*].name 
$.searchResults..name

Test here:http://jsonpath.com Returns :

"Technology & Science Dynamics / TSD",
  "Technology Innovations Group LLC",
  "Technology Marketing Toolkit, Inc.",
  "Technology Solutions Group, Inc.",
  "Technology Services Group - Chicago",
  "Technology Resource Services, Inc.",
  "Technology Plus Inc.",
  "Technology & Business Solutions, LLC",
  "Technology Foundation of the Americas",
  "Technology Business Solutions",
  "Technology Seed",
  "Technology Solutions",
.
.
.
Link to post
Share on other sites

 

All the three works:

$.searchResults.[name]
$.searchResults[*].name 
$.searchResults..name

Test here:http://jsonpath.com Returns :

"Technology & Science Dynamics / TSD",
  "Technology Innovations Group LLC",
  "Technology Marketing Toolkit, Inc.",
  "Technology Solutions Group, Inc.",
  "Technology Services Group - Chicago",
  "Technology Resource Services, Inc.",
  "Technology Plus Inc.",
  "Technology & Business Solutions, LLC",
  "Technology Foundation of the Americas",
  "Technology Business Solutions",
  "Technology Seed",
  "Technology Solutions",
.
.
.

 

Well yes if make a read from file then this works but as you see in the photo its from document text maybe that's where i wrong. Trying to get body with //body/* xpath into variable but seems fails also hmm looking for more alternatives 

Link to post
Share on other sites

The issue was starting at FF because new versions of FF have JSON parser and brokes raw JSON format. Changed to Chrome, tried to get JSON part with XPath was still failing saying too big data to scrape. and I have to scrape it with Regex and then after getting JSON part from DOM with REGEX i was able to use JSON Value parse :) . BTW tried TJ solution but was not happy to put json variable as a parameter and i did without ^_^

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...