Helpful PHP Scripts Pt 5: Update Video Settings in Bulk Without a CSV File
February 11, 2021 - Erikka Innes
This script is part of a collection of scripts from Hervé Pita that help with bulk video uploads. Everything is available in our Helpful PHP Scripts repository on Github. In each part of this series, we'll walk through how to set up one of the scripts. What you'll find includes:
- Ingest Videos from Google Drive - You can transfer all your videos from a folder in Google Drive to your api.video account with this CLI script.
- Ingest Videos from an FTP Server - Transfer all your videos from the FTP server of your choice to your api.video account.
- Export All Your Video Data to .csv - With this script you can grab details about each video in your api.video account and gather it in one .csv spreadsheet.
- Update Metadata for api.video Videos Using CSV - You can update your metadata in bulk with this script.
- Update Video Settings in Bulk Without a CSV File - Update videos to all be public or private or offer an mp4 download or disable an mp4 download.
Today we're going to learn how to use the script that lets you do a bulk update without a CSV file. Rather than choosing custom fields, these are preset. You'll be able to quickly update your videos to all:
- Be public
- Be private
- Support an mp4 download
- Not support an mp4 download
For this project you'll need:
- PHP 5.4 or greater with the command-line interface (CLI) and JSON extension installed
- The Composer dependency management tool (or another way to manage your dependency management). See the Composer website for installation options.
- A GitHub account
- An api.video account
- Your API key for either production or sandbox
- Navigate to the Helpful PHP Scripts repository.
- Click Code and from the drop-down click Download ZIP. (You can also install from the CLI if you prefer.)
- Put the contents of your new .zip file in a folder you want to work from.
- Navigate to the folder containing the contents of your zip file in the terminal.
- In the terminal, type
composer require api-video/php-sdk
Try the Script
- In the terminal, type
- You're asked what environment you want to use, prod or sandbox (p or s). Choose p.
- Provide your API key. Make sure it matches the environment choice you made in the last step. You can get your key by navigating to my.api.video and copying the appropriate key.
- Next, you choose what operation to apply to all your videos. The options are private - this makes all your videos private. public - this makes all your videos public. mp4on - this makes all videos offer an mp4 download. mp4off - this makes all videos disable the option of an mp4 download.
- The script runs and when it's done, you can check to see the settings are updated. If you made a mistake, you can bulk update again to correct, or if you need to change only some videos, try the script that lets you update some files that you list in a .tsv - Update Metadata for api.video Videos Using CSV
And that's it for today!