Antonis Katzourakis / βlog

Automate YoutubeSync

8 Oct 2016

Use Cron Jobs to synchronise your iTunes or Rhythmbox playlists with your Youtube Channel

I just released YoutubeSync on Github. YoutubeSync is an easy-to-use Python tool that syncs your selected Playlists with Youtube. All the playlists are marked as Private for now, but I plan to add support for Unlisted and Public listings.

The usage of the script is super-easy:

python YoutubeSync.py

The first time, you will need to set-up a configuration file. You will then select the Playlists you want to sync.

Here is an example of the first run:

No Configuration file found. Do you want to create a new one? Yes/no 	(default: Yes)
 > Yes
[1] Films
[2] TV Programmes
[3] iTunes U
[4] Audiobooks
[5] Genius
[6] My Top Rated
[7] Recently Added
[8] Recently Played
[9] Top 25 Most Played
[10] Favorites
[11] Dubstep
[12] Voice Memos
Select which Playlists to Sync: 	(Comma-separated numbers as shown above)
 > 10
Should the Playlists you remove from iTunes be deleted from Youtube? [Yes/No] 	(default: No)
 > No
Where to save the Youtube Sync configuration file? 	(default: ~/Documents/.ytSync.conf)
 > 
Configuration File saved

(If you just press enter on the inputs, the default values will be assumed.)

Now that you have the default configuration file set-up, you can set a cron-job to run a sync every 1 hour.

This is how to set this up:

  • Enter this at a Terminal: export VISUAL=nano
    This is to ensure that you will edit the crontab file with nano and not any other editor, like vim.
  • Now, let's edit our crontab: crontab -e
  • Enter the following in the editor
    # Runs every 1 hour
    0 * * * *     /absolute/path/to/YoutubeSync.py

  • IMPORTANT: Please make sure that you have created the configuration file, and that you have done the OAuth authorisation of the App.

If you want to see how crontab works, and how to create a cron job yourself follow this link.

Now, you are ready to restart the cron service.


sudo service cron restart

Enjoy your Music everywhere!