I am looking for solution to download video from youtube. i saw in youtube native application in ios they are providing a feature to save video for offline.
Is there any solution to download video in application? Or any API to download video.
I am looking for solution to download video from youtube. i saw in youtube native application in ios they are providing a feature to save video for offline.
Is there any solution to download video in application? Or any API to download video.
You can download video file from Youtube if we know youtube URL of the video. First you need to download files (HCYoutubeParser) into your project. Now you need to call following function into your code:
let video = HCYoutubeParser.h264videosWithYoutubeURL(yturl!)
let downloadURL = video["medium"] as! String
Where yturl is video URL. We need to pass it into h264videosWithYoutubeURL function. HCYoutubeParser is a class which provides methods for converting Youtube video watch URL into video download URL. This can be done by Youtube video id also. Following method is used for that:
let video = HCYoutubeParser.h264videosWithYoutubeID(ytID!)
let downloadURL = video["medium"] as! String
Where ytID is id of Youtube video. In these code snippet we are getting download URL of medium quality video. For more info and HCYoutubeParser class follow this link: http://findnerd.com/list/view/How-to-download-videos-from-YouTube-in-iOS/22437/
If you are looking for a library then XCDYouTubeKit would be a good choice. If you are looking for an open source app then YouTag might be helpful.
As of May 2024, YouTubeKit is the only thing I could find that works: https://github.com/alexeichhorn/YouTubeKit.git
Massive props to the maintainers
© 2022 - 2024 — McMap. All rights reserved.