|
1 | 1 | # How to Scrape Google Search Results: Python Tutorial
|
2 | 2 |
|
3 |
| -In this tutorial, we showcase how to scrape public Google data with Python and Oxylabs [SERP Scraper API](https://oxylabs.io/products/scraper-api/serp). |
| 3 | +In this tutorial, we showcase how to scrape public Google data with Python and Oxylabs [SERP Scraper API](https://oxylabs.io/products/scraper-api/serp), which requires a subscription or a free trial. |
| 4 | + |
| 5 | + * [What is a Google SERP?](#what-is-a-google-serp) |
| 6 | + * [Is it legal to scrape Google results?](#is-it-legal-to-scrape-google-results) |
| 7 | + * [Scraping public Google data with Python and Oxylabs Scraper API](#scraping-public-google-data-with-python-and-oxylabs-scraper-api) |
| 8 | + * [Set up a payload and send a POST request](#set-up-a-payload-and-send-a-post-request) |
| 9 | + + [Customizing query parameters](#customizing-query-parameters) |
| 10 | + + [Basic parameters](#basic-parameters) |
| 11 | + * [Location query parameters](#location-query-parameters) |
| 12 | + + [Controlling the number of results](#controlling-the-number-of-results) |
| 13 | + + [Python code for scraping Google search data](#python-code-for-scraping-google-search-data) |
| 14 | + + [Export scraped data to a CSV](#export-scraped-data-to-a-csv) |
| 15 | + + [Handling errors and exceptions](#handling-errors-and-exceptions) |
4 | 16 |
|
5 | 17 | ## What is a Google SERP?
|
6 | 18 |
|
@@ -35,7 +47,7 @@ If you’re using Windows, choose Python instead of Python3. The rest of the com
|
35 | 47 |
|
36 | 48 | `d:\amazon>python -m pip install requests`
|
37 | 49 |
|
38 |
| -## 2. Set up a payload and send a POST request |
| 50 | +## Set up a payload and send a POST request |
39 | 51 |
|
40 | 52 | Create a new file and enter the following code:
|
41 | 53 |
|
@@ -195,7 +207,7 @@ if response.status_code != 200:
|
195 | 207 | pprint(response.json())
|
196 | 208 | ```
|
197 | 209 |
|
198 |
| -### 3. Export scraped data to a CSV |
| 210 | +### Export scraped data to a CSV |
199 | 211 | One of the best Google Scraper API features is the ability to parse an HTML page into JSON. For that, you don't need to use BeautifulSoup or any other library – just send the parse parameter as True.
|
200 | 212 |
|
201 | 213 | Here is a sample payload:
|
|
0 commit comments