A Go-based API for scraping X (formerly Twitter) profiles and tweets. This project provides endpoints to fetch user profiles and tweets using the twitter-scraper
library.
- Fetch X user profiles by username.
- Fetch the latest tweets by username.
- Swagger API documentation for easy testing and integration.
- Rate limiting middleware for API protection.
- Environment variable support for sensitive credentials.
- Go 1.24 or higher
- Vercel CLI (for deployment)
-
Clone the repository:
git clone https://github.com/kuloud/tweetgo.git cd tweetgo
-
Install dependencies:
go mod download
-
Set up environment variables: Create a
.env
file in the root directory with the following content:TWITTER_TOKENS="token1:csrf1,token2:csrf2"
Swagger UI is available at:
http://{vercel.app.url}/swagger/
Steps
-
Install Vercel CLI:
npm install -g vercel
-
Deploy the project:
vercel
-
Set environment variables in the Vercel dashboard:
TWITTER_TOKENS
: Twitter tokens in the format: TWITTER_TOKENS="token1:csrf1,token2:csrf2"ADMIN_USERNAME
: Your admin username (local development only)ADMIN_PASSWORD
: Your admin password (local development only)JWT_SECRET_KEY
: Your JWT secret keyPORT
: Set to8080
(local development only)
-
Access the deployed API at the provided Vercel URL.
- API Base URL: https://{vercel.app.url}/api/v1
- Swagger UI: https://{vercel.app.url}/swagger/
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is governed by a Private License Agreement. Unauthorized use, reproduction, or distribution is strictly prohibited. For inquiries, please contact the project owner.