{"flag":true,"single":true,"pageTitle":"Scrape google map reviews using javascript","post":{"id":239,"user_id":"1","slug":"scrape-google-map-reviews-using-javascript-qp2h","title":"Scrape google map reviews using javascript","body":"<pre class=\"language-markup\"><code>javascript:(function() {\r\n\tconst buttons = document.querySelectorAll('button[aria-label=\"See more\"]');\r\n        buttons.forEach(button =&gt; {\r\n            button.click();\r\n        });\r\n    setTimeout(function() {\r\n        \r\n\r\n        let reviewsData = [];\r\n        document.querySelectorAll('.jJc9Ad').forEach(review =&gt; {\r\n            let reviewText = review.querySelector('.wiI7pd') ? review.querySelector('.wiI7pd').innerText : '';\r\n            let rating = review.querySelectorAll('span[class=\"hCCjke google-symbols NhBTye elGi1d\"]').length;\r\n            reviewsData.push({ reviewText, rating });\r\n            console.log(rating+\" \"+reviewText);\r\n        });\r\n\r\n        var rev = reviewsData;\r\n        console.log(rev);\r\n        var reviewis;\r\n        var reviewsString = \"\";\r\n        for (reviewis of rev) {\r\n            if (reviewis.rating == 5 &amp;&amp; reviewis.reviewText != \"\") {\r\n                single_rev = \"_____________START REVIEW\\n\" + reviewis.reviewText + \"\\n_____________END REVIEW\\n\";\r\n                reviewsString += single_rev;\r\n                console.log(single_rev);\r\n            }\r\n        }\r\n\r\n        if (reviewsString.length &gt; 0) {\r\n            var tempInput = document.createElement('textarea');\r\n            tempInput.style.position = 'absolute';\r\n            tempInput.style.left = '-9999px';\r\n            tempInput.value = reviewsString;\r\n            document.body.appendChild(tempInput);\r\n            tempInput.select();\r\n            document.execCommand('copy');\r\n            document.body.removeChild(tempInput);\r\n            alert('Scraped and copied to clipboard:\\n\\n' + reviewsString);\r\n        } else {\r\n            alert('No reviews found on this page.');\r\n        }\r\n   }, 2000);\r\n})();<\/code><\/pre>","category_id":"12","is_private":"0","created_at":"2024-04-11T13:11:38.000000Z","updated_at":"2024-05-18T00:27:58.000000Z","category":{"id":12,"user_id":"1","name":"Javascript","slug":"javascript-xplw","parent_id":null,"created_at":"2023-03-23T02:24:43.000000Z","updated_at":"2023-03-23T02:24:43.000000Z"},"user":{"id":1,"name":"R GONDAL","email":"rizikmw@gmail.com","email_verified_at":null,"two_factor_confirmed_at":null,"current_team_id":"1","profile_photo_path":null,"created_at":"2023-03-12T10:49:33.000000Z","updated_at":"2025-01-10T12:59:00.000000Z","profile_photo_url":"https:\/\/ui-avatars.com\/api\/?name=R+G&color=7F9CF5&background=EBF4FF"}},"pageDesc":"javascript:(function() { \tconst buttons = document.querySelectorAll('button[aria-label=\"See more\"]');         buttons.forEach(button =&gt; { - Scrape google map reviews using javascript (Updated: May 18, 2024) - Read more about Scrape google map reviews using javascript at my programming site [SITE]","categories":[]}