Documentation Index
Fetch the complete documentation index at: https://generaltranslation.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
이 가이드는 지난 7일 동안의 포스트를 찾기 위해 첫 번째 최근 검색 요청을 보내는 과정을 안내합니다.
사전 준비사항시작하기 전에 다음이 필요합니다:
- 승인된 App이 있는 개발자 계정
- 개발자 콘솔의 “Keys and tokens” 아래에서 확인할 수 있는 App의 Bearer 토큰
쿼리 작성
검색 쿼리에서는 연산자를 사용해 포스트를 검색합니다. 먼저 간단한 키워드부터 입력해 보세요:또는 여러 연산자를 함께 사용할 수 있습니다:python lang:en -is:retweet
이는 영어로 작성된 포스트 중에서 “python”을 포함하되 리트윗은 제외합니다. 요청하기
curl "https://api.x.com/2/tweets/search/recent?query=python%20lang%3Aen%20-is%3Aretweet" \
-H "Authorization: Bearer $BEARER_TOKEN"
응답 살펴보기
기본 응답에는 id, text, edit_history_tweet_ids가 포함됩니다.{
"data": [
{
"id": "1234567890123456789",
"text": "Just started learning Python and loving it!",
"edit_history_tweet_ids": ["1234567890123456789"]
},
{
"id": "1234567890123456788",
"text": "Python tip: use list comprehensions for cleaner code",
"edit_history_tweet_ids": ["1234567890123456788"]
}
],
"meta": {
"newest_id": "1234567890123456789",
"oldest_id": "1234567890123456788",
"result_count": 2
}
}
필드 및 expansions 추가
쿼리 매개변수를 사용해 추가 데이터를 요청합니다:curl "https://api.x.com/2/tweets/search/recent?\
query=python%20lang%3Aen%20-is%3Aretweet&\
tweet.fields=created_at,public_metrics,author_id&\
expansions=author_id&\
user.fields=username,verified&\
max_results=10" \
-H "Authorization: Bearer $BEARER_TOKEN"
응답:{
"data": [
{
"id": "1234567890123456789",
"text": "Just started learning Python and loving it!",
"created_at": "2024-01-15T10:30:00.000Z",
"author_id": "9876543210",
"public_metrics": {
"retweet_count": 5,
"reply_count": 2,
"like_count": 42,
"quote_count": 1
},
"edit_history_tweet_ids": ["1234567890123456789"]
}
],
"includes": {
"users": [
{
"id": "9876543210",
"username": "pythondev",
"verified": false
}
]
},
"meta": {
"newest_id": "1234567890123456789",
"oldest_id": "1234567890123456789",
"result_count": 1
}
}
결과 페이지를 순회하기
SDK들은 페이지네이션을 자동으로 처리합니다. cURL을 사용할 때는 응답에 포함된 next_token을 사용하세요:curl "https://api.x.com/2/tweets/search/recent?\
query=python&\
max_results=100&\
next_token=b26v89c19zqg8o3fo7gesq314yb9l2l4ptqy" \
-H "Authorization: Bearer $BEARER_TOKEN"
페이지네이션 가이드
대규모 결과 세트를 탐색하는 방법을 자세히 알아보세요
"machine learning" has:images lang:en
@elonmusk -is:retweet -is:reply
연산자 참고 문서
사용 가능한 모든 연산자 보기