2

Can I do a date-wise download of youtube videos of particular user or playlist using youtube-dl ?

For example - download all videos uploaded by User X in this week.

Looking for provision of downloading youtube videos from a channel/user/playlist with start-date and end-date.

  • No its not. Do not miss the "date-wise" part. – Jaydev Aug 12 '16 at 5:39
  • Downloading a date range with youtube-dl is a little bit more complicated, but there is an answer about that too in a different question: askubuntu.com/questions/334081/… This answer is actually the way I usually do it myself, because I usually don't want to download some of the videos in a playlist, so I have to make a list of all the downloadable video links and then delete the links that I don't want. – karel Aug 12 '16 at 5:42
  • This isn't a duplicate, how do I remove that ? Can I get the video info like date of upload before triggering download? – Jaydev Aug 12 '16 at 5:52
  • Alright, I get it that you want to scrape the videos' date data from the YouTube website automatically, so I retracted my "possible duplicate of...". There is a package for scraping website data in the default Ubuntu repositories, so it should be possible to do it automatically. – karel Aug 12 '16 at 6:01
5

Yes. From the youtube-dl man page:

--date DATE
          Download only videos uploaded in this date

--datebefore DATE
          Download only videos uploaded on or before this date (i.e.  inclusive)

--dateafter DATE
          Download only videos uploaded on or after this date (i.e.  inclusive)

Not stated there, but only hidden in the code, is that DATE is in the format YYYYMMDD or (now|today)[+-][0-9](day|week|month|year)(s)?, so for example the 17th August 2016 would be 20160817, and seven days ago would be now-7days or now-1week.

You can specify a range by using --datebefore and --dateafter together, so:

youtube-dl -i --dateafter 20160808 --datebefore 20160810 https://www.youtube.com/channel/CHANNEL

will download all videos from a channel uploaded between and including August 8th and August 10th 2016, and:

youtube-dl -i --dateafter now-1week https://www.youtube.com/playlist?list=PLAYLIST

will download all videos from a playlist uploaded in the past week.

The -i option prevents youtube-dl from exiting prematurely if some videos are unavailable.

Note youtube-dl will still say it is downloading each video even when it doesn't. For example:

[download] Downloading video 1 of 123
[youtube] xxxxxxxxxxx: Downloading webpage
[youtube] xxxxxxxxxxx: Downloading video info webpage
[youtube] xxxxxxxxxxx: Extracting video information
[youtube] xxxxxxxxxxx: Downloading MPD manifest
[download] 2016-08-07 upload date is not in range 2016-08-08 - 2016-08-10
[download] Downloading video 2 of 123
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.