Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an API for the Google Answer Boxes?

Tags:

The Google Answer Boxes (sometimes called Featured Snippets, Knowledge Cards, or Live Results) are extremely helpful. I'd like to extract the information and use it in my own program. Looking at the HTML code, it's not quite so straight forward as pulling it from there. I've done quite a bit of research, but I can't seem to find any support for them. Does anyone know if there is an API (or part of the Web Search API) where you can retrieve the information returned from the Answer Box?

I saw the answer here: google api for glorious info box? , but the solution presented was deprecated last month.

enter image description here

Just for an example, this is the HTML code for "What is the time in japan":

<!--m--><div data-hveid="30">       <div class="vk_c vk_gy vk_sh card-section _MZc">   <div class="vk_bk vk_ans">6:37 AM</div>  <div class="vk_gy vk_sh"> Tuesday, <span class="_Hq">August 4, 2015</span>   <span class="_Hq"> (GMT+9) </span>   </div> <span class="vk_gy vk_sh">  Time in Japan  </span>  

Which is VERY different from "where is tokyo located":

<!--m--> <div class="_uX kno-fb-ctx" aria-level="3" role="heading" data-hveid="41" data-ved="0CCkQtwcoATACahUKEwiLjemg8I3HAhUTKYgKHU7jCho"> <div class="_eF" data-tts="answers" data-tts-text="Japan">Japan</div> <div class="_Tfc"> </div></div> <!--n--> </li><li class="mod" data-md="61" style="clear:none"> <!--m--> <div class="_oDd" data-hveid="42"> <span class="_Tgc _y9e">Tokyo consists of the southwestern part of the Kanto region, the <b>Izu Islands</b>, and the <b>Ogasawara Islands</b>. Tokyo is the capital of <b>Japan</b>, and the place where over 13 million people live, making it one of the most populous cities in the world.</span></div> 

I essentially need to extract "6:37 AM" from the first and "Japan" from the second, but performing a dynamic string search would be difficult as they are in very different formats.

like image 571
rphello101 Avatar asked Aug 03 '15 22:08

rphello101


People also ask

How does Google have all the answers?

Google's system tracks all the information contained in the search index. In this step, duplicate content is canceled. All this information is stored in the Google Index and a large database is created. Serving Result: Whenever we type on Google to do some search, we get many answers related to our question as well.

What is the Google answer box called?

Interchangeable terms for the answer box include: “position zero,” “featured snippet,” and “instant answer.”

What is Google Quick answer?

Google Quick Answers are highly-visible text snippet answers and links placed at the top of the Google SERPs and were observed to provide a huge boost in organic traffic. Quick Answers appear up to 40% of the time for some types of queries.


2 Answers

There is an instant answer api available from DuckDuckGo that I've used in the past that works pretty well. The responses aren't as robust as google's but it's a good start.

https://duckduckgo.com/api

The api looks like so in a JSON response.

{ Abstract: "" AbstractText: "" AbstractSource: "" AbstractURL: "" Image: "" Heading: "" Answer: "" Redirect: "" AnswerType: "" Definition: "" DefinitionSource: "" DefinitionURL: "" RelatedTopics: [ ] Results: [ ] Type: "" } 

I hope this helps!

like image 54
cfg Avatar answered Sep 19 '22 18:09

cfg


I've done a lot of research and it seems like there isn't anything currently available like you've described. There isn't anything that could pull information from Google Searches either.

The only thing I could think of that could be an alternative is getting information via RSS (http://www.w3schools.com/xml/xml_rss.asp) and implementing that in a program somehow.

like image 32
Andrew1996 Avatar answered Sep 18 '22 18:09

Andrew1996