86c5d7b9-dc66-416d-bdce-4c8dcbe9b210
prompter
Write a bash script that would upload a video to YouTube
fb23cb9b-e4cf-48ba-b465-b9de418ec458
86c5d7b9-dc66-416d-bdce-4c8dcbe9b210
assistant
Here is a sample bash script that can be used to upload a video to YouTube using the YouTube Data API v3:

```bash
#!/bin/bash

# Replace <client_id> and <client_secret> with your own OAuth client credentials
CLIENT_ID="<client_id>"
CLIENT_SECRET="<client_secret>"

# Replace <video_file> with the path to your video file
VIDEO_FILE="<video_file>"

# Request an OAuth access token
ACCESS_TOKEN=$(curl --silent --location --request POST "https://oauth2.googleapis.com/token" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "code=<client_id>" \
--data-urlencode "client_id=${CLIENT_ID}" \
--data-urlencode "client_secret=${CLIENT_SECRET}" \
--data-urlencode "redirect_uri=urn:ietf:wg:oauth:2.0:oob" \
--data-urlencode "grant_type=authorization_code" | jq -r '.access_token')

# Upload the video to YouTube
curl --location --request POST "https://www.googleapis.com/upload/youtube/v3/videos?part=snippet,status" \
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Content-Type: application/octet-stream" \
--data-binary "@${VIDEO_FILE}"
```

Note that this is a basic script and you'll need to obtain OAuth client credentials and set the `VIDEO_FILE` variable before running it. Additionally, you'll need to have `curl` and `jq` installed on your system.