youTubeDownload: Download one single video/audio

Description Usage Arguments Examples

View source: R/youTubeDownload.R

Description

Download one single video/audio

Usage

1
2
3
4
5
6
7
youTubeDownload(
  url,
  path = getwd(),
  saveFile = "videoFromYoutube",
  priority = c("flv"),
  bothVideoAudio = TRUE
)

Arguments

url

the YouTube url to download the video/audio file.

path

the path to save downloaded file. The default is the current directory.

saveFile

the downloaded file name without file extension. The default is "videoFromYoutube".

priority

the file format to download. The option can be any one (or combination) of "mp4", "best", "audio only", "mp3", "webm", the default is c("mp4", "best", "audio only"), which means the downloader will look for mp4 file first, if this file does not exist, then the downloader will look for the best file marked by YouTube, then look for only audio file.

bothVideoAudio

logic, whether download both audio and video, it should be FALSE if only downloading audio or video. The default is TRUE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
{
## Not run: 
# Downlad an audio
url0 = "https://www.youtube.com/watch?v=J9NQFACZYEU&list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj&index=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj"
youTubeDownload(url0, path = "./music",
                saveFile = "videoFromYoutube",
                priority = "audio only",
                bothVideoAudio = FALSE)

# convert to mp3 format.
audio2mp3(path = "./music/")

# Downlad a video
url0 = "https://www.youtube.com/watch?v=pJON0-e_I3o&t=889s"
youTubeDownload(url0, path = "./OneVideo",
                saveFile = "videoFile",
                priority = c("best", "mp4"))

## End(Not run)
}

paodan/youtubeDownloader documentation built on Nov. 15, 2020, 9:48 p.m.