Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To schedule a YouTube playlist rotation on Ubuntu, write a script that uses the YouTube Data API to make your chosen playlist change, then schedule that script in the intended Ubuntu user’s crontab. Cron only runs the command on a schedule; it does not manage playlists or decide what “rotation” means.

Define what “rotation” should do

Choose the intended result before writing the job. YouTube’s API has playlist and playlist-item methods, but no single built-in “rotate” operation. The script must implement your policy.

  • Reorder an existing item: update the playlist item’s position. This keeps the existing playlist entry rather than deleting and creating another one.
  • Remove an item: delete the playlist item. The delete request needs the playlist-item ID returned by the API, not merely the video ID.
  • Add or cycle an item: insert a resource into the playlist, or combine removal and insertion if that is the desired policy. Decide how the script should handle videos that are already present so a scheduled run does not create unwanted duplicates.

The right operation depends on your desired ordering and membership. Google’s insert reference describes the method as: “Adds a resource to a playlist.”

Prepare YouTube API access

Create and authorize an API project

The YouTube Data API workflow requires a Google account, a project in Google Cloud Console, YouTube Data API enablement, and OAuth 2.0 authorization. Playlist writes require an authorized request with a suitable scope; a read-only API key is not enough. The documented insert scopes include youtube, youtube.force-ssl, and youtubepartner. Consult Google’s current authentication guide for the OAuth setup and the current guidance for the client library and version you choose.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
KAMRUI Essenx E2 Mini PC, AMD Ryzen 5 3500U(4 Cores, 8 Threads, Up to 3.7GHz), 16GB DDR4(Expandable) 256GB M.2 SSD Micro PC, HDMI+DP Dual 4K@60Hz Display Home/Business/Office Mini Desktop Computers
  • 【Ryzen 5 3500U Processor】KAMRUI Essenx E2 Mini PC is equipped with AMD Ryzen 5 3500U (4-cores/8-threads, up to 3.7GHz) with integrated Radeon Vega 8 Graphics(1200MHz, 8 Core). The 3500U CPU operates at a base frequency of 2.1 GHz and a Boost frequency of 3.7 GHz. This DDR supports upgradable up to 32GB, SSD supports up to 2TB.(NOT INCLUED), KAMRUI E2 3500U Mini PC is ideal for light office work and home entertainment. KAMRUI E2 3500U is more than 35% more powerful and smoother in operation than the Intel N150, 33% faster than Intel N95, 28% performance boost over Intel i3-10110U, and 42% stronger processing power than AMD Ryzen 3 3200U.
  • 【16GB DDR4 & 256GB SSD】The KAMRUI E2 mini computers is equipped with 16GB DDR4(Expandable up to 32GB) for faster multitasking and smooth application switching. 256GB M.2 SSD ensures fast startup times,fast file transfers and plenty of storage space,eliminating slow loading times and ensuring fast responsiveness.Storage space can RAM supports up to 32 GB, SSD supports up to 2TB (Not included)make file storage easier.
  • 【4K Dual Display & USB 3.2 Type-A Port】KAMRUI E2 3500U mini desktop pc is equipped with an HDMI 2.0+DP 1.4 interfaces for faster transmission, Support Dual 4K@60Hz Display, E2 mini desktop computers is ideal for visual home entertainment, home office, conference rooms, etc. USB3.2 Gen1 Type-A Port×2 with a transfer speed of up to 5Gbps (10 times faster than USB 2.0) for efficient data transfer. The RJ45 1000M Gigabit Ethernet Port ensures a stable network connection.
  • 【WiFi+Bluetooth stable connection】The Kamrui E2 micro pc have reliable and stable wireless connection, open websites in seconds, watch movies without buffering and download files smoothly, connect your monitor from WiFi or Ethernet, use a wireless keyboard and mouse through bluetooth, which will be powerful workstation for you.
  • 【Versatile Ports】This KAMRUI E2 Small pc is equipped with HDMI 2.0×1(4K@60Hz)、DP1.4×1(4K@60Hz)、Gigabit Ethernet Port (RJ45, 10/100/1000Mbps) ×1、USB3.2 Gen1 Type-A Port×2(5Gbps)、USB2.0 Type-A Port×2、3.5mm Audio Jack ×1、DC In ×1、Power Button ×1

Use a Google-supported client library and protect its credential and token files so other local users cannot read them. Because an unattended cron job must remain authorized, follow that library’s current guidance for token storage and refresh, then verify that refresh works for your installation before relying on the schedule. The API documentation does not itself provide a language-specific, validated token-refresh recipe.

Plan API calls and quota

Google’s overview reports a default combined allocation of 10,000 quota units per day for most endpoints; projects can have different allocations, and quota policy can change. The documented costs are 1 unit per playlistItems.list call and 50 units each per playlistItems.insert and playlistItems.delete call. Check the current quota-cost overview and method references before choosing a frequent schedule.

Rank #2
GMKtec M5 Ultra Gaming Mini PC Ryzen 7 7730U 16GB RAM 256GB SSD Computer
  • Office Gaming Mini PC - UPGRADED GMKtec Nucbox M5 Ultra Series is equipped with the powerful AMD Ryzen 7 7730U processor, 8 Cores/16 Threads, Base 2.00GHz (Power Saving Quiet Mode) with Turbo Boost up to 4.50GHz (Performance Mode) in BIOS settings, Based on the ZEN 3+ architecture, this small but powerful mini pc delivers satisfying results in productivity, office work, and gaming. 35% Performance increase over AMD Ryzen 5 7430U/ Ryzen 7 5700U, 5600U, 5560U, 5500U.
  • 16GB DDR4 RAM & 256GB PCIe SSD - Installed with DDR4 16GB RAM (1x16GB), the Nucbox M5 Ultra mini pc support expansion to 64GB RAM. Featured with 256GB M.2 2280 PCIe 3.0 SSD, support dual slot expansion to 4TB SSD. (Upgrades not included)
  • DUAL NIC LAN 2.5G RJ45 - Fast Network Speeds: Enjoy up to 2500Mbps data transmission speed without worrying about lagging. Ideal for working, gaming, and surfing the internet. Great for Untangle, Pfsense or as a server office PC.
  • Mini Desktop Computer with 4K Triple Screen Display - Nucbox M5 Ultra integrates AMD Radeon Graphics 8 Cores 2000 MHz GPU to deliver powerful graphics processing power to easily handle the demands of complex design software, 4K@60Hz UHD video editing, and playback. It can connect to 3 display screens simultaneously.
  • Fast Internet WiFi 6E + BT5.2 Connection - GMKtec Mini PC with WiFi-6E Wireless, have 2.5G/5G/6G triple band, more faster and lower latency. Bluetooth 5.2 allowing you more quickly to connect other wireless devices (headset, mouse, keyboard, etc.) Interface features 2*USB3.2 ports, 2*USB2.0 ports, 1*HDMI 2.0 port(4K@60Hz), 1*USB-C port(PD/DP/DATA), 1*DP Port, 1*Audio 3.5mm (HP&MIC), 1*DC Power Port.

For example, a run that lists items and then deletes and inserts one item uses 101 units at the documented rates (1 + 50 + 50), before any other API calls. Pagination may require more than one list call. An update-based reorder avoids the delete-plus-insert pair; check the current update method’s requirements and cost when implementing that approach.

Write the rotation script

Keep the script responsible for the policy, API calls, and useful error reporting. At minimum, its logic should:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BOSGAME E5 11 Pro Mini PC, AMD Ryzen 5300U 4C/ 8T, Business Home Office PC
  • 【AMD Ryzen 3 5300U CPU: Outperforms N150 & 3500U】 BOSGAME E5 mini PC is powered by the TSMC 7nm FinFET architecture AMD Ryzen 3 5300U processor (4 Cores, 8 Threads, up to 3.8GHz boost, 6MB total cache). Compared to low-end Intel N150 or 3500U chips which only have 4 single threads and throttle under load, the 5300U delivers over 30% faster multi-core speed. Run 30+ browser tabs, large Excel sheets, and Zoom meetings simultaneously without system lag.
  • 【8GB DDR4 RAM & 256GB NVMe SSD Storage】 Installed with high-speed 8GB DDR4 dual-channel memory and a fast 256GB M.2 2280 SSD, eliminating slow boot times and application loading delays. To accommodate growing data requirements, the upgradeable hardware design features dual SODIMM slots that allow you to expand memory up to 64GB RAM, ensuring smooth operation during heavy multitasking.
  • 【High-Capacity Dual M.2 SSD Storage Expansion】 Never worry about running out of space for your business files. In addition to the pre-installed 256GB system drive, the motherboard houses an extra empty internal M.2 2280 NVMe PCIe 3.0 slot. This allows you to easily add a second solid-state drive for up to an additional 2TB of storage capacity (upgrades not included) without needing to remove or reinstall the original operating system.
  • 【Radeon 6-Core Graphics & Triple 4K Displays】 Integrated with official AMD Radeon Graphics (6 Graphics Cores, 1500 MHz frequency) for casual gaming, photo editing, and crisp 4K media decoding. Featuring 1x HDMI 2.0 port, 1x DisplayPort, and 1x Full-Function Type-C port, the E5 outputs true 4K@60Hz resolution to three monitors at once. This multi-screen setup eliminates constant window-switching for traders, programmers, and office workers.
  • 【Dual 2.5GbE LAN Ports for Advanced Networking】 Experience fast wired network transmission speeds up to 2500Mbps without lagging or buffering. The integration of dual 2.5 Gigabit Ethernet ports (powered by Realtek RTL8125 controller) makes this compact computer an exceptional hardware choice for tech enthusiasts. Easily configure it into software routers, hardware firewalls (pfSense, OpnSense), home NAS servers, or local homelabs.
  1. Load the authorized OAuth credentials using the selected library’s supported flow.
  2. List the target playlist’s items, handling pagination if the playlist is longer than one response page.
  3. Identify the exact playlist item or position to change and apply the rule you defined—such as updating a position, deleting an item, or inserting a resource.
  4. Use the playlist-item ID for item updates or deletion, and the required playlist and resource details for insertion.
  5. Log the action and API errors without printing tokens or secrets.

The PlaylistItems API reference documents listing, insertion, updating, and deletion. Do not run a destructive delete-and-reinsert policy until you have decided how it handles duplicate video IDs and confirmed that it produces the ordering you want.

Schedule it in the intended Ubuntu user’s crontab

Use the account that owns the API credentials and script. A user’s crontab runs jobs as that user, not as root by default. Edit it with crontab -e while logged in as that account. Cron checks entries every minute; a schedule line has minute, hour, day-of-month, month, and day-of-week fields followed by the command.

Rank #4
Sale
GMKtec G3S Mini PC Intel N95 Processor (Up to 3.4GHz) 8GB RAM 256GB M.2 SSD
  • 12th Intel Alder Lake N95 Processor – The GMKtec G3 S Mini PC is powered by the 12th Gen Intel N95 processor with 4 cores, 4 threads, 6MB cache and a burst frequency up to 3.4GHz. Compared with N100/N5105/N5100/N5095, the N95 delivers up to 36% overall performance improvement. Perfect for routine tasks, office work, and home entertainment, this compact mini desktop is more convenient than traditional bulky PCs.
  • 8GB RAM & 256GB SSD Storage – Pre-installed with 8GB DDR4 memory and a fast 256GB M.2 2242 SSD, the G3 S mini desktop offers quicker startup, smoother multitasking, and faster file transfers. Enjoy seamless performance whether you’re working on multiple applications, browsing, or streaming content.
  • Rich Interfaces & Connectivity – The G3 S mini computer comes equipped with USB 3.2 (up to 10Gbps), dual HDMI 2.0 (4K@60Hz), and a 3.5mm audio jack. With support for WiFi 5, Bluetooth 5.0, and Gigabit Ethernet (RJ45 1000MbE), it connects easily with monitors, projectors, printers, office equipment, and other peripherals, making it versatile for both home and business use.
  • Dual 4K Display Support – Featuring upgraded Intel UHD Graphics (up to 1000MHz), the G3 S supports 4K video playback and AV1 decoding for a smooth viewing experience. With dual HDMI outputs, you can connect two 4K@60Hz displays simultaneously, enabling efficient multitasking for work and entertainment.
  • GMKtec WARRANTY - GMKtec offers a 1-year limited GMKtec's warranty for each mini PC, starting from the date of the purchase. All defects due to design and workmanship are covered. With a professional after sales team always ready to attend to your needs, you can simply relax and enjoy your mini PC.
  1. Test the script directly first. Run it as the same user who will own the crontab and confirm it can access its credentials, reach the API, and perform the intended playlist change.
  2. Create a writable log directory. For example, ensure /home/ubuntu/logs exists and is writable by the crontab owner.
  3. Add a schedule line. This illustrative entry runs daily at 08:15 according to the cron schedule’s timezone:
    # minute hour day-of-month month day-of-week command
    15 8 * * * /usr/bin/python3 /home/ubuntu/bin/rotate_playlist.py >> /home/ubuntu/logs/rotate_playlist.log 2>&1

    Replace the username, interpreter, script path, and log path with the real values on your machine. The example is a template, not tested code.

  4. Save the crontab and verify the next run. Inspect the redirected log and, if needed, the system cron log or journal for your Ubuntu release.

Use absolute paths: cron runs with a non-interactive environment and should not be assumed to inherit your interactive shell’s PATH or other settings. Set any required environment variables explicitly in the crontab or script, taking care not to expose credentials in logs.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Set the schedule’s timezone deliberately

Cron’s schedule timezone and the command’s environment timezone are not necessarily the same setting. Ubuntu’s Noble cron manual documents CRON_TZ for a crontab schedule in a specified timezone. The Jammy cron manual cautions that setting TZ in the crontab affects the command’s environment, not the schedule. Confirm the installed Ubuntu release and cron package before relying on a timezone directive; otherwise, interpret the schedule in the cron service’s configured timezone.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot missed or failed rotations

  • The script works interactively but not from cron: check that the crontab belongs to the expected user, replace relative paths with absolute paths, and explicitly configure environment values the script requires.
  • OAuth or permission errors: confirm the credentials belong to the intended Google account, authorize an applicable write scope, and verify the library can refresh its stored authorization in the non-interactive job.
  • The wrong item is deleted or updated: use the playlist-item ID returned by the API. A video ID alone is not the identifier required by item deletion.
  • The playlist gains duplicates or the ordering is wrong: review the rotation policy and test its behavior against an existing playlist. Reordering an item and deleting then reinserting it are different operations.
  • No useful error appears: inspect the redirected log and the Ubuntu system cron log or journal. Cron output may be mailed depending on local mail configuration, so a file log is easier to retrieve.
  • The job is expected to run after boot but starts too early: @reboot does not guarantee that networking or other dependencies are ready. Do not assume it waits for OAuth-related services or connectivity; use a deliberate readiness strategy if the script requires them.
  • Runs fail after repeated API calls: compare the number of list, insert, delete, and other requests with the project’s current quota allocation, including pagination and retries.

Or let it run in the cloud

For playlist automation, cron on Ubuntu is the DIY method; StreamNeo is a separate option for keeping uploaded videos live on YouTube, not for scheduling playlist-item changes through the API. Upload a recording or build a playlist, add your YouTube stream key once, and go live. StreamNeo loops the uploaded videos from the cloud, so nothing has to stay on at home. It supports any uploaded quality up to 4K 60fps at one price per slot, automatically recovers if YouTube drops the stream, and the first day is free with no card. Monthly: $9.99 per month. Learn more at StreamNeo, or start a free day.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.