Watchapedia API is a RESTful API service that analyzes movie information and user preferences. It provides personalized movie recommendations and statistics by analyzing users' movie viewing history, ratings, and preferences.
- Complex user preference analysis using window functions (PERCENT_RANK)
- Sophisticated rating calculations with weighted scoring
- Multi-table joins for comprehensive movie metadata analysis
- Subquery optimization for performance
- Weighted scoring algorithm for actor/director preferences
- Genre and country preference analysis with normalized scores
- User style classification based on rating patterns
- Personalized movie recommendations based on viewing history
- Efficient database connection pooling
- Query parameterization for security and performance
- Optimized JOIN operations for complex queries
- Smart caching of frequently accessed data
- Box office movie recommendations
- Recent review history
- Movies from favorite directors
- Movies from favorite actors
- Movie rating statistics
- Rating distribution analysis
- Preferred tags analysis
- Favorite actors/directors analysis
- Preferred countries/genres analysis
- Movie watching time statistics
- User movie preference style analysis
- Rated movies and ratings
- Watchlist movies
- Currently watching movies
- Average rating
- Favorite actors list
- Favorite directors list
- Highest rated movies
- Most commented movies
- Latest movies
- Python 3.x
- Flask (Web Framework)
- PyMySQL (Database Connector)
- MySQL (Database)
- Install required packages:
pip install flask pymysql python-dotenv- Set up MySQL database:
- Database name: watchapedia
- User: root
- Password: (configure in .env file)
- Create .env file with the following variables:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_password_here
DB_NAME=watchapedia
DB_CHARSET=utf8mb4
FLASK_ENV=development
FLASK_DEBUG=True
PORT=5000
LOG_LEVEL=DEBUG
- Run the servers:
python home.py
python preference.py
python storage.py
python mypage.py
python movie.pyGET /home/<user_id>: Get personalized home screen information
GET /preference/<user_id>: Get user preference analysis information
GET /storage/<user_id>: Get user's movie storage information
GET /mypage/<user_id>: Get user profile information
GET /movies: Get movie recommendations and statistics
The project includes the following main tables:
- users: User information
- movies: Movie information
- comments: Movie ratings and comments
- actors: Actor information
- directors: Director information
- genres: Genre information
- countries: Country information
- movie_state: Movie watching status
- favorite_actors: Favorite actors
- favorite_directors: Favorite directors
- movie_tags: Movie tags
- tags: Tag information
- movieactors: Movie-actor relationships
