# Google Trends Trending Now API

You have to send a GET request to **`http://api.scrapingdog.com/google_trends/trending_now`** with the below-given parameters.

Google Trends Trending Now API pricing is available [here](https://www.scrapingdog.com/google-search-api).

### Parameters

Scrapingdog Parameters

| Parameter                                                          | Description                                                                                               |
| ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------- |
| <p>api\_key<br></p><p><mark style="color:red;">required</mark></p> | <p>Your personal API key. Available on your dashboard. <br><br>Type: <em><strong>String</strong></em></p> |

#### Search Query

| Parameter                                                  | Description                                                                                                                                                                                                                    |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p>geo<br><br><mark style="color:red;">required</mark></p> | <p>This parameter specifies the location from which the search originates. By default, it is set to the US if the <code>geo</code> parameter is not provided or left empty. <br><br>Type: <em><strong>String</strong></em></p> |

#### Advanced Parameters

| Parameter | Description                                                                                                                                                                                                                                                                                                                                                                                                          |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| hours     | <p></p><p>This parameter specifies the time range in past hours for retrieving results. By default, it is set to 24 (Past 24 hours). Google provides the following predefined values:<br></p><ul><li><code>4</code> (Past 4 hours)</li><li><code>24</code> (Past 24 hours)</li><li><code>48</code> (Past 48 hours)</li><li><code>168</code> (Past 7 days)</li></ul><p><br>Type: <em><strong>String</strong></em></p> |

#### Localization

| Parameter | Description                                                                                                                                                                                                                                    |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| language  | <p>This parameter specifies the language for the Google Trends Trending Now search. It accepts a two-letter language code (e.g., "en" for English, "es" for Spanish, or "fr" for French).</p><p><br>Type: <em><strong>String</strong></em></p> |

### API Example

{% tabs %}
{% tab title="cURL" %}

```json
curl "https://api.scrapingdog.com/google_trends/trending_now/?api_key=5eaa61a6e562fc52fe763tr516e4653&geo=US"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_key = "5eaa61a6e562fc52fe763tr516e4653"
url = "https://api.scrapingdog.com/google_trends/trending_now"

params = {
    "api_key": api_key,
    "geo": "US"
}

response = requests.get(url, params=params)

if response.status_code == 200:
    data = response.json()
    print(data)
else:
    print(f"Request failed with status code: {response.status_code}")

```

{% endtab %}

{% tab title="Node JS" %}

```javascript
const axios = require('axios');

const api_key = '5eaa61a6e562fc52fe763tr516e4653';
const url = 'https://api.scrapingdog.com/google_trends/trending_now';

const params = {
  api_key: api_key,
  geo: 'US'
};

axios
  .get(url, { params: params })
  .then(function (response) {
    if (response.status === 200) {
      const data = response.data;
      console.log(data)
    } else {
      console.log('Request failed with status code: ' + response.status);
    }
  })
  .catch(function (error) {
    console.error('Error making the request: ' + error.message);
  });

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

// Set the API key and request parameters
$api_key = '5eaa61a6e562fc52fe763tr516e4653';
$geo = 'US';

// Set the API endpoint
$url = 'https://api.scrapingdog.com/google_trends/trending_now/?api_key=' . $api_key . '&geo=' . $geo;

// Initialize cURL session
$ch = curl_init($url);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the cURL request
$response = curl_exec($ch);

// Check if the request was successful
if ($response === false) {
    echo 'cURL error: ' . curl_error($ch);
} else {
    // Process the response data as needed
    echo $response;
}

// Close the cURL session
curl_close($ch);

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'uri'

# Set the API key and request parameters
api_key = '5eaa61a6e562fc52fe763tr516e4653'
geo = 'US'

# Construct the API endpoint URL
url = URI.parse("https://api.scrapingdog.com/google_trends/trending_now/?api_key=#{api_key}&geo=#{geo}")

# Create an HTTP GET request
request = Net::HTTP::Get.new(url)

# Create an HTTP client
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true # Enable SSL (https)

# Send the request and get the response
response = http.request(request)

# Check if the request was successful
if response.is_a?(Net::HTTPSuccess)
  puts response.body # Process the response data as needed
else
  puts "HTTP request failed with code: #{response.code}, message: #{response.message}"
end

```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        try {
            // Set the API key and request parameters
            String apiKey = "5eaa61a6e562fc52fe763tr516e4653";
            String geo = "US"

            // Construct the API endpoint URL
            String apiUrl = "https://api.scrapingdog.com/google_trends/trending_now/?api_key=" + apiKey
                    + "&geo=" + geo

            // Create a URL object from the API URL string
            URL url = new URL(apiUrl);

            // Open a connection to the URL
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();

            // Set the request method to GET
            connection.setRequestMethod("GET");

            // Get the response code
            int responseCode = connection.getResponseCode();

            if (responseCode == 200) {
                // Read the response from the connection
                BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String inputLine;
                StringBuilder response = new StringBuilder();

                while ((inputLine = reader.readLine()) != null) {
                    response.append(inputLine);
                }
                reader.close();

                // Process the response data as needed
                System.out.println(response.toString());
            } else {
                System.out.println("HTTP request failed with response code: " + responseCode);
            }

            // Close the connection
            connection.disconnect();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}
{% endtabs %}

### Response

```json
{
    "trending_searches": [
        {
            "title": "richard chamberlain",
            "start_timestamp": 1743336000,
            "end_timestamp": "",
            "active": true,
            "search_volume": 200000,
            "increase_percentage": 1000,
            "id": [
                4
            ],
            "trend_breakdown": [
                "richard chamberlain",
                "martin rabbett",
                "the thorn birds",
                "dr kildare",
                "richard chamberlin",
                "shogun",
                "richard chamberlain shogun",
                "richard chamberlain net worth",
                "richard chamberlain death"
            ]
        },
     ....
   ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scrapingdog.com/google-trends-api-documentation/google-trends-trending-now-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
