How to fix excel VBA to extract google cse JSON API results.

satish78

Board Regular
Joined
Aug 31, 2014
Messages
218
Hi Friends,

I have constructed list of Google CSE JSON API urls with keywords to extract Linkedin profiles data into excel.
I have VBA script which can extract Google CSE ATOM results. But, unfortunately Google has change ATOM results to JSON API results.
So, the script is not useful anymore.


I need title, url and snippet into ColumnA, ColumnB and ColumnC in sheet2.
Here is sample Macro enabled file with urls in sheet1 and sheet3 additional urls to test run on them.

https://spaces.hightail.com/space/83i4MjL8p4
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try the JSON parser at https://github.com/VBA-tools/VBA-JSON. Copy JsonConverter.bas (except the Attribute line at the top) to a new module and name the module JsonConverter.

Is there any alternative one apart from JSON Parser. Because, queries with "", : etc does not work and does not skip urls which does have data to extract.

Here is sample file in which each search term or terms must be encoded to get url in ColumnB. https://spaces.hightail.com/space/83i4MjL8p4
and terms encoded has ", : etc cannot get results. Some code errors.
Please take a look.
 
Upvote 0
There are several other JSON parsers.

I've looked at your search URLs. These include the search query parameter q, for example:

"....&key=xxxxx&q= " & ENCODEURL(A1)
where A1 contains "more:p:person-role:developer gmail.com texas"

There should be no space after the 'q='. Also, where did you get that query syntax from? Can you post a link to the API documentation showing this query syntax?
 
Upvote 0
There are several other JSON parsers.

I've looked at your search URLs. These include the search query parameter q, for example:

"....&key=xxxxx&q= " & ENCODEURL(A1)
where A1 contains "more:p:person-role:developer gmail.com texas"

There should be no space after the 'q='. Also, where did you get that query syntax from? Can you post a link to the API documentation showing this query syntax?


these are from "google structured data testing tool" which provides "data sets"(https://developers.google.com/search/docs/data-types/dataset) where we can search any google custom search engine with these queries like other examples
more:p:hcard-title:developer which gives results whose jobtitle includes developer.
more:p:metatags-og_title:dallas which gives results whose is located in dallas area.
 
Upvote 0
Isn't that just extra markup for web site owners to add to their web pages, which Google will later use in its search results?

Where is the custom search API documentation showing examples of this search query syntax?
 
Upvote 0
Isn't that just extra markup for web site owners to add to their web pages, which Google will later use in its search results?

Where is the custom search API documentation showing examples of this search query syntax?

Did you get it, How the query syntax works with more:P:person-title etc.
Could you please update the code? If you have got that issue resolved and also for no data found urls to skip.
 
Upvote 0
Did you get it, How the query syntax works with more:P:person-title etc.
Could you please update the code? If you have got that issue resolved and also for no data found urls to skip.
No, I haven't found any documentation showing whether 'your' query syntax is accepted by the Custom Search API. I suggest you try your queries using the API explorer at https://developers.google.com/custom-search/v1/cse/list. AFAIK the q parameter only accepts a simple search term, without any of the fancy parameters you are trying.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top