X Profile Scraper API
With X Profile Scraper API, you can scrape any profile. You just have to pass the ID of that person, and our API will return the parsed JSON data.
Last updated
With X Profile Scraper API, you can scrape any profile. You just have to pass the ID of that person, and our API will return the parsed JSON data.
Last updated
Each successful request will cost you 5
API credits. X Scraping API pricing is available .
You have to send a GET request to http://api.scrapingdog.com/x/profile
with the below-given parameters.
api_key
required
Your personal API key. Available on your dashboard. Type: String
profileId
required
This is the user ID. Type: String
curl "https://api.scrapingdog.com/x/profile?api_key=5eaa61a6e562fc52fe763tr516e4653&profileId=elonmusk&parsed=true"
import requests
api_key = '5eaa61a6e562fc52fe763tr516e4653'
profileId = 'elonmusk'
parsed = 'true' # Use 'true' or 'false' based on your requirements
params = {
'api_key': api_key,
'profileId': profileId,
'parsed': parsed
}
response = requests.get('https://api.scrapingdog.com/x/profile', params=params)
if response.status_code == 200:
# Parse the JSON response using response.json()
response_data = response.json()
# Now you can work with the response_data as a Python dictionary
print(response_data)
else:
print(f'Request failed with status code: {response.status_code}')
const axios = require('axios');
const api_key = '5eaa61a6e562fc52fe763tr516e4653';
const profileId = 'elonmusk';
const parsed = 'true'; // Use 'true' or 'false' based on your requirements
const params = {
api_key,
profileId,
parsed,
};
axios
.get('https://api.scrapingdog.com/x/profile', { params })
.then((response) => {
if (response.status === 200) {
// Parse the JSON response
const responseData = response.data;
console.log(responseData);
} else {
console.error(`Request failed with status code: ${response.status}`);
}
})
.catch((error) => {
console.error('An error occurred:', error);
});
require 'httparty'
require 'json'
api_key = '5eaa61a6e562fc52fe763tr516e4653'
profileId = 'elonmusk'
parsed = 'true' # Use 'true' or 'false' based on your requirements
# Define the API endpoint
endpoint = 'https://api.scrapingdog.com/x/profile'
# Create a hash with the query parameters
params = {
api_key: api_key,
tweetId : tweetId,
parsed: parsed
}
# Make the GET request
response = HTTParty.get(endpoint, query: params)
# Check the HTTP response code
if response.code == 200
# Parse the JSON response
parsed_response = JSON.parse(response.body)
puts parsed_response
else
puts "Request failed with status code: #{response.code}"
end
<?php
$api_key = '5eaa61a6e562fc52fe763tr516e4653';
$profileId = 'elonmusk';
$parsed = 'true'; // Use 'true' or 'false' based on your requirements
// Create an array with the query parameters
$params = array(
'api_key' => $api_key,
'profileId' => $profileId,
'parsed' => $parsed
);
// Initialize cURL session
$ch = curl_init('https://api.scrapingdog.com/x/profile?' . http_build_query($params));
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the cURL request
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo 'cURL error: ' . curl_error($ch);
} else {
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpCode === 200) {
// Parse the JSON response
$responseData = json_decode($response, true);
print_r($responseData);
} else {
echo 'Request failed with status code: ' . $httpCode;
}
}
// Close cURL session
curl_close($ch);
?>
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.json.JSONObject;
public class TwitterApiExample {
public static void main(String[] args) {
String api_key = "5eaa61a6e562fc52fe763tr516e4653";
String profileId = "elonmusk";
String parsed = "true"; // Use 'true' or 'false' based on your requirements
String endpoint = "https://api.scrapingdog.com/x/profile";
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(endpoint + "?api_key=" + api_key + "&tweetId=" + tweetId + "&parsed=" + parsed)
.get()
.build();
try {
Response response = client.newCall(request).execute();
ResponseBody responseBody = response.body();
if (response.isSuccessful() && responseBody != null) {
String jsonString = responseBody.string();
JSONObject jsonResponse = new JSONObject(jsonString);
System.out.println(jsonResponse.toString(4)); // Pretty print the JSON response
} else {
System.err.println("Request failed with status code: " + response.code());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
{
"user": {
"typename": "User",
"id": "VXNlcjo0NDE5NjM5Nw==",
"rest_id": "44196397",
"affiliates_highlighted_label": {
"label": {
"url": {
"url": "https://twitter.com/X",
"urlType": "DeepLink"
},
"badge": {
"url": "https://pbs.twimg.com/profile_images/1683899100922511378/5lY42eHs_bigger.jpg"
},
"description": "X",
"userLabelType": "BusinessLabel",
"userLabelDisplayType": "Badge"
}
},
"parody_commentary_fan_label": "None",
"is_blue_verified": true,
"profile_picture": "https://pbs.twimg.com/profile_images/1926284313365979137/o2cF3MeJ_normal.jpg",
"profile_name": "Elon Musk",
"profile_handle": "elonmusk",
"profile_url": "https://www.x.com/elonmusk",
"description": "",
"likes_count": 151468,
"followers_count": 221041700,
"following_count": 1147,
"listed_count": 162896,
"location": "",
"media_count": 3915,
"pinned_tweet_ids_str": [
"1933399839490126217"
],
"statuses_count": 80069,
"verified": false,
"translator_type": "none",
"withheld_in_countries": []
}
}