This is a simple tool that helps you find YouTube videos based on your questions or errors using ChatGPT and the YouTube Data API.
- Go programming language installed.
mpv
installed and added to the system PATH. You can install it from mpv.io.- YouTube Data API key and OpenAI developer key. Place these keys in a
.env
file in the root directory of the project.
-
Clone the repository:
git clone https://github.com/anishfish2/CLIck.git
-
Navigate to the project directory:
cd CLIck
-
Install dependencies:
go mod tidy
You can run the program with the following command:
go run main.go
The program supports the following flags:
-query
: Specify the error or question you're facing. Default is "Code broken :(".-ask
: Whether to ask ChatGPT for help. Default is true.-video
: Whether to display the video. Default is false.
Example usage:
go run main.go -query="How do I fix a segmentation fault?" -video=true
- If the
-ask
flag is set to true, the program uses ChatGPT to generate a search query based on your error or question. - If the
-video
flag is set to true, the program then uses the YouTube Data API to search for a video related to the generated search query. - It retrieves the video URL and plays the video using
mpv
.