A FastAPI-based platform that integrates YouTube and Google Ads APIs to search for videos and video advertisements.
- YouTube video search with filters for:
- Keywords
- Categories
- Channel names
- Video advertisement search with:
- Keyword filtering
- Category filtering
- Channel ID filtering
- Duration-based filtering (short ads)
- Channel-based video search
- Search by channel ID
- Get channel metadata
- Filter channel videos
- Simple token-based authentication
- No registration required
- Easy token generation
- Token expiration handling
- RESTful API endpoints
- Swagger/OpenAPI documentation
- Rate limiting and error handling
- Install Dependencies
pip install -r requirements.txt
- Configure Environment Variables
Create a
.env
file with:
YOUTUBE_API_KEY=your_youtube_api_key
JWT_SECRET_KEY=your_jwt_secret_key
- Run the Application
./run.sh
# or
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
- Access API Documentation
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
POST /api/auth/token
- Returns: JWT token
- Description: Generate a token for authentication
GET /api/search-videos
- Query params: keyword, category, channel_name
- Returns list of videos with metadata
GET /api/search-video-ads
- Query params: keyword, category
- Returns list of video advertisements
GET /api/search-unlisted-ads
- Query params: keyword, category, channel_id, duration
- Returns list of unlisted advertisements
video and ads/
├── app/
│ ├── api/
│ │ ├── routes.py # API endpoints
│ │ └── auth.py # Authentication endpoints
│ ├── config/
│ │ └── settings.py # Configuration management
│ ├── models/
│ │ ├── video.py # Video data models
│ │ ├── auth.py # Authentication data models
│ │ ├── unlisted_ad.py # unlisted data models
│ │ └── ad.py # Advertisement data models
│ ├── utils/
│ │ └── auth.py # Authentication utilities
│ ├── middleware/
│ │ └── auth.py # Authentication middleware
│ ├── services/
│ │ ├── youtube_service.py # YouTube API integration
│ │ ├── unlisted_ad.py # Unlisted ad integration
│ │ └── ads_service.py # Ads API integration
│ └── main.py # FastAPI application
├── .env # Environment variables
├── requirements.txt # Python dependencies
└── run.sh # Startup script