Closed idoor88 closed 5 years ago
Hello,
the downloadFromInfo() function is not implemented. ytdl-core uses the node stream module and m3u8stream to download files.
Unfortunately this packages are not available for react-native. You could use rn-fetch-blob instead. But for Android apps i would honestly stick to the native Android Download Manager. Conveniently, rn-fetch-blob offers the possibility to use the Download Manager.
Just get the wanted url with ytdl.chooseFormat and choose you preferred method to download.
ytdl.getInfo(videoID, {}, (err, info) => {
const format = ytdl.chooseFormat(info.formats, {quality: 'highest'});
RNFetchBlob
.config({
addAndroidDownloads: {
useDownloadManager: true,
mime: format.type
}
})
.fetch('GET', format.url)
.then((resp) => {
resp.path()
})
})
Got you, thanks
Hi, I am trying to test downloading a youtube video with the following code, but got error saying: downloadFromInfo is not a function:
`videoID = "04GiqLjRO3A";
So any idea what is going on? I checked your ytdl.js file, there is no downloadFromInfo function in there.
Thanks