Home > Software engineering >  Is there any way I can scrape/grab the "about" section of a google search?
Is there any way I can scrape/grab the "about" section of a google search?

Time:11-19

I am building out an flutter app for school that lists dog breeds. I am wondering if it is possible to pull down the "about section" for a google search query. I am using flutter/dart but I think this question is language agnostic, I just want to know if it's possible. This is what I am talking about: enter image description here

I want to grab the paragraph under the "about" header. Is this possible?

CodePudding user response:

However, there's a lots of ways you can do this. One way you can use this API called SerpApi

This returns the results in Json

Just SignUp in this service. and with http package you can get results like so

import 'package:http/http.dart' as http;

var url = Uri.parse('https://serpapi.com/search');
var query = "Samoyed" // Your query;

var response = await http.get(url   "?q=$query&google_domain=google.com&api_key=secret_api_key");

print(response.body);

You'll get

"knowledge_graph":
{
"title":
"Samoyed",
"type":
"Dog breed",
"header_images":
[
{
"image":
"https://serpapi.com/searches/619669ffc47d3ccfb5511aa1/images/1dbd475a36109a83173d2d6a380adb0cd740843c4a06be6455a87b252b4811b3f717889baa84eb34.jpeg",
"source":
"https://en.wikipedia.org/wiki/Samoyed_dog"
},
{
"image":
"https://serpapi.com/searches/619669ffc47d3ccfb5511aa1/images/1dbd475a36109a83173d2d6a380adb0cd740843c4a06be6477e61734e5c35299fd9ba84a832499c2.jpeg",
"source":
"https://www.akc.org/dog-breeds/samoyed/"
},
{
"image":
"https://serpapi.com/searches/619669ffc47d3ccfb5511aa1/images/1dbd475a36109a83173d2d6a380adb0cd740843c4a06be641d71587a667af36fd5c22ede97ad0d5d.jpeg",
"source":
"https://www.thesprucepets.com/samoyed-dog-breed-profile-4586270"
},
{
"image":
"https://serpapi.com/searches/619669ffc47d3ccfb5511aa1/images/1dbd475a36109a83173d2d6a380adb0cd740843c4a06be6407d380d689b958ece6cfa86598a2b35e.jpeg",
"source":
"https://www.rover.com/blog/samoyed-puppies-complete-guide/"
},
{
"image":
"https://serpapi.com/searches/619669ffc47d3ccfb5511aa1/images/1dbd475a36109a83173d2d6a380adb0cd740843c4a06be64097c7c54fd3dce6ea08aeb17527d8bfa.jpeg",
"source":
"https://www.dailypaws.com/dogs-puppies/dog-breeds/samoyed"
},
{
"image":
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTDUBrb001EttjCvMAByRCKQvioc2KHy6rD7McCmeJ1wg&s",
"source":
"http://www.vetstreet.com/dogs/samoyed"
}
],
"description":
"The Samoyed is a breed of medium-sized herding dogs with thick, white, double-layer coats. They are a spitz-type dog which takes its name from the Samoyedic peoples of Siberia.",
"source":
{
"name":
"Wikipedia",
"link":
"https://en.wikipedia.org/wiki/Samoyed_dog"
},....

CodePudding user response:

You have to use this API from Google https://developers.google.com/knowledge-graph

  • Related