A Simple YouTube Guessing Game
H8 FIGHTER is a simple guessing game where the user sees two random YouTube videos and guesses which one has the most dislikes.
As you can tell from the starting page, I came up with this idea when news came out that YouTube is now hiding the dislike count in all of its videos.
The dislike button is the least offensive way to express displeasure towards a video for any reason. Whether the video is outright bad, the video expresses an opinion that you don't agree with or just for the sake of being controversial.
I created this project using technologies that weren't taught in bootcamp, so I had to rely heavily on tutorial videos to make it work. The like-to-dislike ratio is a good indicator of telling whether a video serves its purpose, regardless of its quality. Unfortunately, I have to use a third party to access this feature.
Compare the two videos and guess which one has the most dislikes.
Click the green target button of that video and the results will show up.
Can you get a high score of 10?
This project is containerized using Docker
If you have Docker installed, you can run this project by adding your API key for the YouTube Data API and using docker-compose up
.
- The client is created using Vue.js
- Dynamic components are used to create views that are only navigatable within the website.
- Bulma is used for the styling
- An automatic dark-mode feature is implemented that will turn the website dark once dark mode is enabled on the user's system.
- The user's high score will be saved in their browser's local storage.
- A Flask API whose single purpose is to return a random YouTube video from the MYSQL database in JSON format.
- A MYSQL database to hold all of the random YouTube videos and their dislikes.
There wasn't really a good way to efficiently get a random YouTube video using the YouTube Data API. Along with that, I wasn't able to get the worker to function before YouTube removed the "dislikeCount" feature from their API, so here's what I did to generate random YouTube videos along with the number of dislikes they have:
I used the Beautiful Soup package to extract a random YouTube video ID from Random YouTube Video Generator. I couldn't use this feature too frequently, so I decided to extract video IDs every 10 minutes and save that data into a MYSQL database. To handle the scheduled task, I utilized Celery Beets with Redis.
I passed the video ID into the YouTube Data API to get the video title and channel name. I wouldn't need to use the YouTube Data API altogether if I didn't need the channel name. I could extract the video title from Random YouTube Generator.
Return YouTube Dislike is a popular browser extension that brings back the dislike count feauture on YouTube. It does this by using "a combination of archived data from before the offical YouTube dislike API shut down, and extrapolated extension user behavior."
Return YouTube Dislike also has an API that allows me to pass in a video ID and see the dislike count. Because the video IDs are entirely random, some of the videos in my database have little to no dislikes.
I could fix this by only allowing the worker to add popular videos to the database.