Home > Blockchain >  Scraping google maps reviews but it return only one user rating
Scraping google maps reviews but it return only one user rating

Time:06-07

I am working on a scraping project in which I am scraping google maps reviews with the help of this URL: https://www.google.com/async/reviewDialog?hl=en&async=feature_id:0x47e66e2964e34e2d:0x8ddca9ee380ef7e0,sort_by:,start_index:,associated_topic:,_fmt:pc

and parsing it with cheerio:

$('.lcorif').each((i,el) => {

    rating[i] = $(el)
    .find(".EBe2gf").attr("aria-label")
    console.log(i)
    console.log(rating) //it gives me only first rating

 })

How can I get all user's ratings in the correct way?

CodePudding user response:

So I found out that the parent selector tag is only iterating the loop once, so I used this:

$('.gws-localreviews__google-review').each((i,el) => {
        rating[i] = $(el)
       .find(".EBe2gf").attr("aria-label")
})

And I got all user's ratings.

  • Related