# Twitter Tweets

{% hint style="success" %}
To enable this engine, set the **`engine=twitter_tweets`** parameter.
{% endhint %}

Scraping Twitter tweets is a powerful technique for gathering meaningful insights about trending topics, user opinions, and sentiments. With our API, you can easily extract tweets enabling you to identify emerging trends and understand what people are talking about in real-time.

<figure><img src="/files/v4y2wJQmWQM5cexNs9Gy" alt=""><figcaption><p>Scrape Tweets</p></figcaption></figure>

### Twitter Tweets API Specific Parameters

#### #1: URL Parameter

<table><thead><tr><th width="133.33333333333331">Parameter</th><th width="99">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>url</code><br><mark style="color:red;background-color:red;">required</mark></td><td><code>string</code></td><td>The URL of the tweet you are looking to scrape information from.</td></tr></tbody></table>

### Twitter Tweets API Integration Examples

We will use following URL as an example for this request:

```
https://social.webscrapingapi.com/v1?engine=twitter_tweets&api_key=<YOUR-API-KEY>&url=https://twitter.com/netflix/status/1508551897287782400
```

### Ready to Use Twitter Profile Scraping Scripts:

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
curl --request GET --url "https://social.webscrapingapi.com/v1?engine=twitter_tweets&api_key=<YOUR-API-KEY>&url=https://twitter.com/netflix/status/1508551897287782400"
```

{% endcode %}
{% endtab %}

{% tab title="NodeJS" %}
{% code overflow="wrap" fullWidth="false" %}

```javascript
const http = require("https");

const options = {
  "method": "GET",
  "hostname": "social.webscrapingapi.com",
  "port": null,
  "path": "/v1?engine=twitter_tweets&api_key=<YOUR-API-KEY>&url=https://twitter.com/netflix/status/1508551897287782400",
  "headers": {}
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" fullWidth="false" %}

```python
import http.client

conn = http.client.HTTPSConnection("social.webscrapingapi.com")

conn.request("GET", "/v1?engine=twitter_tweets&api_key=<YOUR-API-KEY>&url=https://twitter.com/netflix/status/1508551897287782400")

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code overflow="wrap" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://social.webscrapingapi.com/v1?engine=twitter_tweets&api_key=<YOUR-API-KEY>&url=https://twitter.com/netflix/status/1508551897287782400",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code overflow="wrap" %}

```go
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://social.webscrapingapi.com/v1?engine=twitter_tweets&api_key=<YOUR-API-KEY>&url=https://twitter.com/netflix/status/1508551897287782400"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code overflow="wrap" %}

```java
HttpResponse<String> response = Unirest.get("https://social.webscrapingapi.com/v1?engine=twitter_tweets&api_key=<YOUR-API-KEY>&url=https://twitter.com/netflix/status/1508551897287782400")
    .asString();
```

{% endcode %}
{% endtab %}

{% tab title=".NET" %}
{% code overflow="wrap" %}

```csharp
var client = new RestClient("https://social.webscrapingapi.com/v1?engine=twitter_tweets&api_key=<YOUR-API-KEY>&url=https://twitter.com/netflix/status/1508551897287782400");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code overflow="wrap" %}

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

url = URI("https://social.webscrapingapi.com/v1?engine=twitter_tweets&api_key=<YOUR-API-KEY>&url=https://twitter.com/netflix/status/1508551897287782400")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
```

{% endcode %}
{% endtab %}
{% endtabs %}

<details>

<summary>Response Example</summary>

```json
{
  "search_parameters": {
    "twitter_url": "https://twitter.com/netflix/status/1508551897287782400",
    "engine": "twitter",
    "twitter_domain": "twitter.com",
    "device": "desktop",
    "url": "https://twitter.com/netflix/status/1508551897287782400"
  },
  "search_information": {
    "organic_results_state": "Results for exact spelling",
    "total_results": null,
    "query_displayed": null
  },
  "post_id": "1508551897287782400",
  "post_url": "https://twitter.com/netflix/status/1508551897287782400",
  "post_text": "My favorite moment of the #Oscars is my mom- the real Linda Mitchell- meeting Maya Rudolph- who is just a national treasure.  It made me so unbelievably happy.    @DebbieRianda ’s year is made!",
  "post_time": "2022-03-28T17:08:51.000Z",
  "post_retweets": 379,
  "post_comments": 53,
  "post_likes": 6503,
  "status": "Ok"
}
```

</details>


---

# 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.webscrapingapi.com/twitter-search-api/twitter-search-engines/twitter-tweets.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.
