A YouTube bot I did for one of my tech interviews.
- Install requirements from
requirements.txt
- Modify configuration in
ytbot/config.py
if needed - Run
python3 -m ytbot
in the repo directory
Test with pytest
.
pytest doesn't recognize the humanfriendly
library well when
run from command line, works in an IDE though. I consider it
low-priority for now, but will try to fix it soon.
Implement a browser automation application which performs the following steps:
- Open Chrome browser installed on the hosting system
- Navigate to https://www.youtube.com
- Search for 'Python' and select the first video from the results list
- Wait until a potential pre-roll ad has been shown
- Drag the video duration slider to approx. the middle of the video
- Mute the video
- Read the following info from the website and write it to standard out:
- Title of the video
- Duration of the video
- Name of the channel
- Amount of views
- Date of upload
- Amount of likes
- Amount of dislikes
- Switch to the first suggested video in the 'next' panel on the right
- Play the video until 10 seconds of it have elapsed
- Pause the video afterwards