2

Here is my script to download a video if its video-id is known:

 youtube-dl -f 134 -ciw -o video.mp4 https://www.youtube.com/watch?v=xxxxxxxxxxx

Is there any way by which I can download the latest video from now on from a particular channel as soon as the video is uploaded using cronjob or some other method?

Saif
  • 2,530
  • 3
  • 27
  • 45
  • 1
    You won't be able to access any YouTube video unless it is uploaded and made public. So simple answer to your question will be **No**. – Sandip Nirmal Jul 31 '18 at 12:03

1 Answers1

1

As far as I know there is no method that is implemented into youtube-dl directly to download the latest video.

You can use the Youtube Data API to get the Channel's Upload Playlist-ID.

https://developers.google.com/youtube/v3/docs/channels/list

After that you can periodically poll the Videos that are on the Upload Playlist of that Channel.

https://developers.google.com/youtube/v3/docs/playlistItems/list

There is an SDK for Java for example, so you could write a Java Application to retrieve the latest Upload, and then launch the youtube-dl Process like this.

Here is an example to retrieve your own Uploads using the Youtube API (just to get you started).

Dominik
  • 1,016
  • 11
  • 30