Guide to Download youtube Playlist and Complete channel to Drive using Colab and Youtube-dl

Requirements:
This tutorial will guide you to download youtube video, Youtube playlist, or entire youtube channel to your drive or Team Drive.
We will be installing and using Youtube-dl for this task.

Step 1:
Open Google Colab
Step 2:
Mount your drive in Google Colab
Step 3:
Goto insert and select New Code so that we can put our code
Step 4:
Install youtube-dl using the following command

Open this colab script. Paste the youtube, playlist / videos / channel link and select the required settings and download.

It can also download other direct download links.

Supported sites from which it can download the videos are:
https://ytdl-org.github.io/youtube-dl/supportedsites.html

33 Likes

Thanks! Nice share. Is it possible to download with subtitles?

1 Like

How to mount google drive? and there is no new code on the insert tab…

1 Like

run this code to mount drive

from google.colab import drive
drive.mount(‘/content/drive’)

1 Like

ValueError Traceback (most recent call last)
in ()
1 from google.colab import drive
----> 2 drive.mount(‘/content/drive’)

/usr/local/lib/python3.6/dist-packages/google/colab/drive.py in mount(mountpoint, force_remount, timeout_ms, use_metadata_server)
152 raise ValueError(‘Mountpoint must not be a symlink’)
153 if _os.path.isdir(mountpoint) and _os.listdir(mountpoint):
→ 154 raise ValueError(‘Mountpoint must not already contain files’)
155 if not _os.path.isdir(mountpoint) and _os.path.exists(mountpoint):
156 raise ValueError(‘Mountpoint must either be a directory or not exist’)

ValueError: Mountpoint must not already contain files

1 Like

Haven’t faced such error. so don’t know how to fix. Go to runtime> reset runtime.
And try again.

Updated the thread. Now you don’t have to paste the code or do other things. Just run the script as suggested and download.

thanks man,but there is another way to download it by using 4k video downloader

4k downloader downloads it to your harddrive but it downloads it in your google drive.

I clicked on ad intentionally to support 1Hack team, thank you.

2 Likes

Updated the thread. Now you can see which sites are supported from this tool.

1 Like

Thanks :heart_eyes:

Thank you so much

Thank you great tool. how do you change the folder of the video is going to be?

1 Like

This used colab space and if the size of videos are big like more than 110gb(provided by colab) then runtime will crash and no file will be downloaded , it would be better if it download video one by one and then transfer video to drive and clearing the space occupied by it, so that it become possible to download videos of big size(>110gb). it’s possible please add pause/resume functionality.

i have got an error

/bin/bash: /usr/local/bin/youtube-dl: Permission denied
can someone help me

How to use this script to download videos that are located in google drive team drive?

nice one, Im gonna try :slight_smile: thanks

Thanks Buddy…!
Really helpful post

There is one issue with this. When we download bigger playlist, it is filling the disk space and not moving the files immediately to the Google drive. If this script is modified in such a way that, it copies to Gdrive/shared drive once download completes.