A bot to automatically comment, like, or dislike YouTube videos based on a search query.
Note: If a video has already been liked or disliked, the script will skip it and will not add a comment.
YouTube limits the number of comments, likes, dislikes, and queries you can send. A 403 error will be raised when this limit is reached. See the YouTube API quota documentation for more details.
- Create a Google Cloud Console project (free)
- Create an OAuth 2.0 credential in the project
- Download the OAuth credentials file into the project folder and rename it
secret.json - Install Python
- Install dependencies:
pip install -r requirements.txt
python main.py --query "my query" [--comments "My comment" "My other comment" --rating like --size 50 --sleep 20]| Argument | Required | Default | Description |
|---|---|---|---|
--query |
β Yes | β | The search query used to find videos |
--comments |
No | β | One or more comments to randomly post on each video |
--rating |
No | like |
Rate the video: like or dislike |
--size |
No | 50 |
Number of videos to process (min: 0, no max) |
--sleep |
No | 30 |
Pause in seconds between each action (helps avoid quota limits) |
--region |
No | β | Restrict results to a specific country (two-letter code, e.g. US) |
python main.py --query "lo-fi music" --comments "Great video!" "Love this" --rating like --size 20 --sleep 15 --region USWhen you run the script, it will prompt you to:
- Open a URL in your browser
- Grant Google account access
- Copy the token Google returns
- Paste it into the console
- Comments are selected randomly from the list you provide via
--comments - The
--sleepflag is useful for long-running sessions to avoid hitting the API quota - Please be kind in your comments π