π¨π³ δΈζ | π¬π§ English
You can play with the demo here:
This is the backend part of the analyzer without database, so you can easily clone it and run it on your own server.
If you want to add database, help yourself to add it.
YouTube Favorite Analyzer is a powerful tool that analyzes a YouTube user's favorite playlists to infer their demographics, interests, and characteristics. By leveraging the YouTube API and OpenAI's GPT capabilities, this project provides insightful profiles based on the user's favorite content.
- YouTube Data Integration: Fetches and processes your favorite YouTube playlists.
- Profile Generation: Generates detailed user profiles including demographics and interests.
- Formatted & Regular Responses: Choose between structured formatted responses or plain regular outputs.
- Easy Setup: Simple installation and configuration process.
- Extensible: Easily extendable with additional features and integrations.
-
Clone the Repository
git clone https://github.com/xbhk/get_YouTubeProfile_through_LLM.git cd get_YouTubeProfile_through_LLM -
Create a Virtual Environment
It's recommended to use a virtual environment to manage dependencies.
python3 -m venv venv source venv/bin/activate -
Install Dependencies
All required dependencies are listed in
requirements.txt.pip install -r requirements.txt
To use the YouTube Data API, you need to set up credentials:
-
Create a Project
Go to the Google Cloud Console and create a new project.
-
Enable YouTube Data API
Navigate to APIs & Services > Library, search for "YouTube Data API v3", and enable it.
-
Create Credentials
- Go to APIs & Services > Credentials.
- Click Create Credentials > OAuth client ID.
- Choose Desktop app and provide a name.
- Download the
credentials.jsonfile and place it in the project root directory.
mv path/to/downloaded/credentials.json secrets-local.json
This project uses OpenAI's GPT for generating detailed profiles. To set it up:
-
Obtain API Key
Sign up at OpenAI and navigate to the API section to obtain your API key.
-
Set Up Environment Variable
Create a
.envfile in the project root directory and add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key_here
Ensure you have a .env file in the project root with the necessary environment variables:
OPENAI_API_KEY=your_openai_api_key_hereget_YouTubeProfile_through_LLM/
βββ youtube-onelayers.py
βββ functionOneLayer
βββ profile.md
βββ requirements.txt
βββ secrets-local.json
βββ .env
βββ README.md
Run the main script to generate your profile based on your YouTube favorite playlists:
python youtube-onelayers.pyThe script will perform the following:
- Authenticate with the YouTube API.
- Fetch your favorite playlists.
- Analyze the playlists to generate a user profile.
- Output the profile to
profile.md.
- Regular Response: A plain text profile saved in
profile.md. - Formatted Response: A structured and detailed profile saved in
profile.md.
π€― Playlist Analysis Complete!
π Core Demographics:
- Age Range: Likely 18-35 years
- Gender: Predominantly male
- Likely Region: Asia (with specific interests in China)
π― Key Insights:
- Primary Interests:
- Web Development (including AI tools and frameworks)
- Personal Productivity (like journaling and learning tools)
- Current Affairs & Social Issues
- Content Level: Enthusiast
- Notable Patterns: Strong interest in practical tutorials and discussions about social issues and economic contexts; tends to engage with both educational and entertaining content.
π§ Your Characteristics:
- Curious - You enjoy learning new technologies and frameworks, as shown by your interest in web development and AI tools.
- Open-Minded - You explore a variety of topics, including social issues and cultural discussions.
- Pragmatic - You lean towards practical applications and tutorials that can assist you in your personal or professional projects.
- Socially Aware - You follow content that touches on economic and political themes, demonstrating a sense of responsibility and awareness towards societal issues.
π Content Preferences:
- Tutorials and How-To Videos - You prefer structured content that guides you through learning processes, especially related to tech and productivity tools.
- Current Events and Cultural Commentary - Showing interest in videos discussing societal topics shows your engagement with the world around you.
- Innovative Tools and Techniques - You're drawn to the latest trends and tools that can enhance your productivity or web development skills, pointing to a mindset that values innovation.
β¨ Fun Fact: Your eclectic mix of interests suggests that you might be the go-to person among your friends for tech advice or recommendations on the latest productivity apps! π§ We will be glad if we guess right! π§
Note: I have already intergrated with the frontend.
Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.
For any questions or suggestions, feel free to reach out at [email protected].


