Exploring TwitterXApi's Advanced Twitter Search Endpoint: A Guide to Fetching Trump's Tweets on X
API Overview
The endpoint is a POST request to https://api.twitterxapi.com/twitter/advanced_search. It requires Bearer token authentication (get yours from the TwitterXApi dashboard). The request body is JSON with search parameters.
import requests
url = "https://api.twitterxapi.com/twitter/advanced_search"
payload = {
"maxItems": 10,
"sortBy": "Latest",
"searchTerms": ["from:realDonaldTrump"]
}
headers = {
"Authorization": "Bearer your token",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
0 Replies